Skip to content

Commit 14d7dad

Browse files
committed
---
yaml --- r: 152141 b: refs/heads/try2 c: 8e8f6a0 h: refs/heads/master i: 152139: 5bc8f26 v: v3
1 parent b1db9ed commit 14d7dad

File tree

20 files changed

+101
-201
lines changed

20 files changed

+101
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 874b56d3379a63aed6ada5c25c69cc9ab3cdf92c
8+
refs/heads/try2: 8e8f6a0372576b35a21d4785b2e4291a13fccf02
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ config.mk
6060
/rt/
6161
/rustllvm/
6262
/test/
63+
/build
6364
/inst/
6465
/mingw-build/
6566
src/.DS_Store

branches/try2/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ let ys = xs;
11121112
11131113
xs = Nil;
11141114
1115-
// `xs` can be used again
1115+
// `xs` can't be used again
11161116
~~~
11171117

11181118
A destructor call will only occur for a variable that has not been moved from,

branches/try2/src/liballoc/arc.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ impl<T: Send + Share + Clone> Arc<T> {
152152
#[inline]
153153
#[experimental]
154154
pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
155-
// Note that we hold a strong reference, which also counts as
156-
// a weak reference, so we only clone if there is an
157-
// additional reference of either kind.
158-
if self.inner().strong.load(atomics::SeqCst) != 1 ||
159-
self.inner().weak.load(atomics::SeqCst) != 1 {
155+
if self.inner().strong.load(atomics::SeqCst) != 1 {
160156
*self = Arc::new(self.deref().clone())
161157
}
162158
// This unsafety is ok because we're guaranteed that the pointer
@@ -360,20 +356,6 @@ mod tests {
360356
assert!(*cow1 == *cow2);
361357
}
362358

363-
#[test]
364-
fn test_cowarc_clone_weak() {
365-
let mut cow0 = Arc::new(75u);
366-
let cow1_weak = cow0.downgrade();
367-
368-
assert!(75 == *cow0);
369-
assert!(75 == *cow1_weak.upgrade().unwrap());
370-
371-
*cow0.make_unique() += 1;
372-
373-
assert!(76 == *cow0);
374-
assert!(cow1_weak.upgrade().is_none());
375-
}
376-
377359
#[test]
378360
fn test_live() {
379361
let x = Arc::new(5);

branches/try2/src/liballoc/rc.rs

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,6 @@ impl<T> Rc<T> {
8686
}
8787
}
8888

89-
impl<T: Clone> Rc<T> {
90-
/// Acquires a mutable pointer to the inner contents by guaranteeing that
91-
/// the reference count is one (no sharing is possible).
92-
///
93-
/// This is also referred to as a copy-on-write operation because the inner
94-
/// data is cloned if the reference count is greater than one.
95-
#[inline]
96-
#[experimental]
97-
pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
98-
// Note that we hold a strong reference, which also counts as
99-
// a weak reference, so we only clone if there is an
100-
// additional reference of either kind.
101-
if self.strong() != 1 || self.weak() != 1 {
102-
*self = Rc::new(self.deref().clone())
103-
}
104-
// This unsafety is ok because we're guaranteed that the pointer
105-
// returned is the *only* pointer that will ever be returned to T. Our
106-
// reference count is guaranteed to be 1 at this point, and we required
107-
// the Rc itself to be `mut`, so we're returning the only possible
108-
// reference to the inner data.
109-
let inner = unsafe { &mut *self._ptr };
110-
&mut inner.value
111-
}
112-
}
113-
11489
impl<T> Deref<T> for Rc<T> {
11590
/// Borrow the value contained in the reference-counted box
11691
#[inline(always)]
@@ -259,7 +234,6 @@ impl<T> RcBoxPtr<T> for Weak<T> {
259234
}
260235

261236
#[cfg(test)]
262-
#[allow(experimental)]
263237
mod tests {
264238
use super::{Rc, Weak};
265239
use std::cell::RefCell;
@@ -330,66 +304,4 @@ mod tests {
330304

331305
// hopefully we don't double-free (or leak)...
332306
}
333-
334-
#[test]
335-
fn test_cowrc_clone_make_unique() {
336-
let mut cow0 = Rc::new(75u);
337-
let mut cow1 = cow0.clone();
338-
let mut cow2 = cow1.clone();
339-
340-
assert!(75 == *cow0.make_unique());
341-
assert!(75 == *cow1.make_unique());
342-
assert!(75 == *cow2.make_unique());
343-
344-
*cow0.make_unique() += 1;
345-
*cow1.make_unique() += 2;
346-
*cow2.make_unique() += 3;
347-
348-
assert!(76 == *cow0);
349-
assert!(77 == *cow1);
350-
assert!(78 == *cow2);
351-
352-
// none should point to the same backing memory
353-
assert!(*cow0 != *cow1);
354-
assert!(*cow0 != *cow2);
355-
assert!(*cow1 != *cow2);
356-
}
357-
358-
#[test]
359-
fn test_cowrc_clone_unique2() {
360-
let mut cow0 = Rc::new(75u);
361-
let cow1 = cow0.clone();
362-
let cow2 = cow1.clone();
363-
364-
assert!(75 == *cow0);
365-
assert!(75 == *cow1);
366-
assert!(75 == *cow2);
367-
368-
*cow0.make_unique() += 1;
369-
370-
assert!(76 == *cow0);
371-
assert!(75 == *cow1);
372-
assert!(75 == *cow2);
373-
374-
// cow1 and cow2 should share the same contents
375-
// cow0 should have a unique reference
376-
assert!(*cow0 != *cow1);
377-
assert!(*cow0 != *cow2);
378-
assert!(*cow1 == *cow2);
379-
}
380-
381-
#[test]
382-
fn test_cowrc_clone_weak() {
383-
let mut cow0 = Rc::new(75u);
384-
let cow1_weak = cow0.downgrade();
385-
386-
assert!(75 == *cow0);
387-
assert!(75 == *cow1_weak.upgrade().unwrap());
388-
389-
*cow0.make_unique() += 1;
390-
391-
assert!(76 == *cow0);
392-
assert!(cow1_weak.upgrade().is_none());
393-
}
394-
395307
}

branches/try2/src/libcollections/bitv.rs

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313

1414
use std::cmp;
15+
use std::fmt;
1516
use std::iter::RandomAccessIterator;
1617
use std::iter::{Enumerate, Repeat, Map, Zip};
1718
use std::ops;
1819
use std::slice;
19-
use std::string::String;
2020
use std::uint;
2121

2222
#[deriving(Clone)]
@@ -526,25 +526,6 @@ impl Bitv {
526526
Vec::from_fn(self.nbits, |i| self[i])
527527
}
528528

529-
/**
530-
* Converts `self` to a string.
531-
*
532-
* The resulting string has the same length as `self`, and each
533-
* character is either '0' or '1'.
534-
*/
535-
pub fn to_str(&self) -> String {
536-
let mut rs = String::new();
537-
for i in self.iter() {
538-
if i {
539-
rs.push_char('1');
540-
} else {
541-
rs.push_char('0');
542-
}
543-
};
544-
rs
545-
}
546-
547-
548529
/**
549530
* Compare a bitvector to a vector of `bool`.
550531
*
@@ -604,6 +585,15 @@ impl ops::Index<uint,bool> for Bitv {
604585
}
605586
}
606587

588+
impl fmt::Show for Bitv {
589+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
590+
for bit in self.iter() {
591+
try!(write!(fmt, "{}", if bit { 1 } else { 0 }));
592+
}
593+
Ok(())
594+
}
595+
}
596+
607597
#[inline]
608598
fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
609599
if bits == 0 {
@@ -827,6 +817,21 @@ impl cmp::Eq for BitvSet {
827817
fn ne(&self, other: &BitvSet) -> bool { !self.eq(other) }
828818
}
829819

820+
impl fmt::Show for BitvSet {
821+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
822+
try!(write!(fmt, r"\{"));
823+
let mut first = true;
824+
for n in self.iter() {
825+
if !first {
826+
try!(write!(fmt, ", "));
827+
}
828+
try!(write!(fmt, "{}", n));
829+
first = false;
830+
}
831+
write!(fmt, r"\}")
832+
}
833+
}
834+
830835
impl Container for BitvSet {
831836
#[inline]
832837
fn len(&self) -> uint { self.size }
@@ -1629,6 +1634,16 @@ mod tests {
16291634
assert!(!v.none());
16301635
}
16311636

1637+
#[test]
1638+
fn test_bitv_set_show() {
1639+
let mut s = BitvSet::new();
1640+
s.insert(1);
1641+
s.insert(10);
1642+
s.insert(50);
1643+
s.insert(2);
1644+
assert_eq!("{1, 2, 10, 50}".to_string(), s.to_str());
1645+
}
1646+
16321647
fn rng() -> rand::IsaacRng {
16331648
let seed = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
16341649
rand::SeedableRng::from_seed(seed)

branches/try2/src/libcollections/hashmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,8 +2013,8 @@ mod test_map {
20132013

20142014
let map_str = format!("{}", map);
20152015

2016-
assert!(map_str == "{1: 2, 3: 4}".to_string() || map_str == "{3: 4, 1: 2}".to_string());
2017-
assert_eq!(format!("{}", empty), "{}".to_string());
2016+
assert!(map_str == "{1: 2, 3: 4}".to_owned() || map_str == "{3: 4, 1: 2}".to_owned());
2017+
assert_eq!(format!("{}", empty), "{}".to_owned());
20182018
}
20192019

20202020
#[test]

branches/try2/src/libcollections/treemap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,8 @@ mod test_treemap {
13661366

13671367
let map_str = format!("{}", map);
13681368

1369-
assert!(map_str == "{1: 2, 3: 4}".to_string());
1370-
assert_eq!(format!("{}", empty), "{}".to_string());
1369+
assert!(map_str == "{1: 2, 3: 4}".to_owned());
1370+
assert_eq!(format!("{}", empty), "{}".to_owned());
13711371
}
13721372

13731373
#[test]
@@ -1776,7 +1776,7 @@ mod test_set {
17761776

17771777
let set_str = format!("{}", set);
17781778

1779-
assert!(set_str == "{1, 2}".to_string());
1780-
assert_eq!(format!("{}", empty), "{}".to_string());
1779+
assert!(set_str == "{1, 2}".to_owned());
1780+
assert_eq!(format!("{}", empty), "{}".to_owned());
17811781
}
17821782
}

branches/try2/src/libdebug/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ fn test_repr() {
613613
fn exact_test<T>(t: &T, e:&str) {
614614
let mut m = io::MemWriter::new();
615615
write_repr(&mut m as &mut io::Writer, t).unwrap();
616-
let s = str::from_utf8(m.unwrap().as_slice()).unwrap().to_string();
616+
let s = str::from_utf8(m.unwrap().as_slice()).unwrap().to_owned();
617617
assert_eq!(s.as_slice(), e);
618618
}
619619

branches/try2/src/libgreen/sched.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,8 @@ impl ClosureConverter for UnsafeTaskReceiver {
977977
// worry there.
978978
#[cfg(windows)]
979979
fn new_sched_rng() -> XorShiftRng {
980-
use std::rand::OsRng;
981-
match OsRng::new() {
980+
use std::rand::OSRng;
981+
match OSRng::new() {
982982
Ok(mut r) => r.gen(),
983983
Err(e) => {
984984
rtabort!("sched: failed to create seeded RNG: {}", e)

branches/try2/src/librand/isaac.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;
2424
///
2525
/// The ISAAC algorithm is generally accepted as suitable for
2626
/// cryptographic purposes, but this implementation has not be
27-
/// verified as such. Prefer a generator like `OsRng` that defers to
27+
/// verified as such. Prefer a generator like `OSRng` that defers to
2828
/// the operating system for cases that need high security.
2929
///
3030
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
@@ -231,7 +231,7 @@ static RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
231231
///
232232
/// The ISAAC algorithm is generally accepted as suitable for
233233
/// cryptographic purposes, but this implementation has not be
234-
/// verified as such. Prefer a generator like `OsRng` that defers to
234+
/// verified as such. Prefer a generator like `OSRng` that defers to
235235
/// the operating system for cases that need high security.
236236
///
237237
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number

branches/try2/src/librand/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub trait SeedableRng<Seed>: Rng {
333333
///
334334
/// The Xorshift algorithm is not suitable for cryptographic purposes
335335
/// but is very fast. If you do not know for sure that it fits your
336-
/// requirements, use a more secure one such as `IsaacRng` or `OsRng`.
336+
/// requirements, use a more secure one such as `IsaacRng` or `OSRng`.
337337
///
338338
/// [1]: Marsaglia, George (July 2003). ["Xorshift
339339
/// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of

branches/try2/src/libregex/re.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,13 @@ impl<'t> Replacer for NoExpand<'t> {
573573

574574
impl<'t> Replacer for &'t str {
575575
fn reg_replace<'a>(&'a mut self, caps: &Captures) -> MaybeOwned<'a> {
576-
Owned(caps.expand(*self))
576+
Owned(caps.expand(*self).into_owned())
577577
}
578578
}
579579

580580
impl<'a> Replacer for |&Captures|: 'a -> String {
581581
fn reg_replace<'r>(&'r mut self, caps: &Captures) -> MaybeOwned<'r> {
582-
Owned((*self)(caps))
582+
Owned((*self)(caps).into_owned())
583583
}
584584
}
585585

branches/try2/src/librustdoc/html/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl fmt::Show for clean::Type {
356356
}
357357
}
358358
}
359-
ret
359+
ret.into_owned()
360360
})
361361
}
362362
clean::Proc(ref decl) => {

0 commit comments

Comments
 (0)