summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-03 22:36:53 -0800
committerbors <bors@rust-lang.org>2014-01-03 22:36:53 -0800
commit3dd7c49faf5ae3a9158ab242a264c0f0eb99f657 (patch)
tree0393c0b2e10c7579d86c222071bb9c64b0451b60 /src/libstd
parent0ff6c12ce94993dae702d597a213eee6b969231a (diff)
parent80921536343e87d2f7d7f19ad90d63f50b557e06 (diff)
downloadrust-3dd7c49faf5ae3a9158ab242a264c0f0eb99f657.tar.gz
rust-3dd7c49faf5ae3a9158ab242a264c0f0eb99f657.zip
auto merge of #11251 : pcwalton/rust/remove-at-mut, r=pcwalton
r? @nikomatsakis 

for the borrow checker changes. Write guards are now eliminated.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/clone.rs31
-rw-r--r--src/libstd/default.rs4
-rw-r--r--src/libstd/io/extensions.rs6
-rw-r--r--src/libstd/managed.rs38
-rw-r--r--src/libstd/num/mod.rs5
-rw-r--r--src/libstd/repr.rs3
-rw-r--r--src/libstd/rt/task.rs12
-rw-r--r--src/libstd/to_bytes.rs7
8 files changed, 12 insertions, 94 deletions
diff --git a/src/libstd/clone.rs b/src/libstd/clone.rs
index b383c9edf36..b26ceb799a7 100644
--- a/src/libstd/clone.rs
+++ b/src/libstd/clone.rs
@@ -58,12 +58,6 @@ impl<T> Clone for @T {
     fn clone(&self) -> @T { *self }
 }
 
-impl<T> Clone for @mut T {
-    /// Return a shallow copy of the managed box.
-    #[inline]
-    fn clone(&self) -> @mut T { *self }
-}
-
 impl<'a, T> Clone for &'a T {
     /// Return a shallow copy of the borrowed pointer.
     #[inline]
@@ -168,14 +162,6 @@ impl<T: Freeze + DeepClone + 'static> DeepClone for @T {
     fn deep_clone(&self) -> @T { @(**self).deep_clone() }
 }
 
-// FIXME: #6525: should also be implemented for `T: Send + DeepClone`
-impl<T: Freeze + DeepClone + 'static> DeepClone for @mut T {
-    /// Return a deep copy of the managed box. The `Freeze` trait is required to prevent performing
-    /// a deep clone of a potentially cyclical type.
-    #[inline]
-    fn deep_clone(&self) -> @mut T { @mut (**self).deep_clone() }
-}
-
 macro_rules! deep_clone_impl(
     ($t:ty) => {
         impl DeepClone for $t {
@@ -240,23 +226,6 @@ fn test_managed_clone() {
 }
 
 #[test]
-fn test_managed_mut_deep_clone() {
-    let x = @mut 5i;
-    let y: @mut int = x.deep_clone();
-    *x = 20;
-    assert_eq!(*y, 5);
-}
-
-#[test]
-fn test_managed_mut_clone() {
-    let a = @mut 5i;
-    let b: @mut int = a.clone();
-    assert_eq!(a, b);
-    *b = 10;
-    assert_eq!(a, b);
-}
-
-#[test]
 fn test_borrowed_clone() {
     let x = 5i;
     let y: &int = &x;
diff --git a/src/libstd/default.rs b/src/libstd/default.rs
index aaba23c683b..60f38e3b3de 100644
--- a/src/libstd/default.rs
+++ b/src/libstd/default.rs
@@ -16,10 +16,6 @@ pub trait Default {
     fn default() -> Self;
 }
 
-impl<T: Default + 'static> Default for @mut T {
-    fn default() -> @mut T { @mut Default::default() }
-}
-
 impl<T: Default + 'static> Default for @T {
     fn default() -> @T { @Default::default() }
 }
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs
index a7361fa8c37..1b6d1171a52 100644
--- a/src/libstd/io/extensions.rs
+++ b/src/libstd/io/extensions.rs
@@ -371,15 +371,17 @@ mod test {
 
     #[test]
     #[should_fail]
+    #[ignore] // borrow issues with RefCell
     fn push_bytes_fail_reset_len() {
         // push_bytes unsafely sets the vector length. This is testing that
         // upon failure the length is reset correctly.
         let mut reader = ErroringLaterReader {
             count: 0,
         };
-        let buf = @mut ~[8, 9];
+        // FIXME (#7049): Figure out some other way to do this.
+        //let buf = @mut ~[8, 9];
         (|| {
-            reader.push_bytes(&mut *buf, 4);
+            //reader.push_bytes(&mut *buf, 4);
         }).finally(|| {
             // NB: Using rtassert here to trigger abort on failure since this is a should_fail test
             // FIXME: #7049 This fails because buf is still borrowed
diff --git a/src/libstd/managed.rs b/src/libstd/managed.rs
index 7322f0b0647..c5705665896 100644
--- a/src/libstd/managed.rs
+++ b/src/libstd/managed.rs
@@ -31,13 +31,6 @@ pub fn ptr_eq<T>(a: @T, b: @T) -> bool {
     a_ptr == b_ptr
 }
 
-/// Determine if two mutable shared boxes point to the same object
-#[inline]
-pub fn mut_ptr_eq<T>(a: @mut T, b: @mut T) -> bool {
-    let (a_ptr, b_ptr): (*T, *T) = (to_unsafe_ptr(&*a), to_unsafe_ptr(&*b));
-    a_ptr == b_ptr
-}
-
 #[cfg(not(test))]
 impl<T:Eq> Eq for @T {
     #[inline]
@@ -47,14 +40,6 @@ impl<T:Eq> Eq for @T {
 }
 
 #[cfg(not(test))]
-impl<T:Eq> Eq for @mut T {
-    #[inline]
-    fn eq(&self, other: &@mut T) -> bool { *(*self) == *(*other) }
-    #[inline]
-    fn ne(&self, other: &@mut T) -> bool { *(*self) != *(*other) }
-}
-
-#[cfg(not(test))]
 impl<T:Ord> Ord for @T {
     #[inline]
     fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
@@ -67,40 +52,17 @@ impl<T:Ord> Ord for @T {
 }
 
 #[cfg(not(test))]
-impl<T:Ord> Ord for @mut T {
-    #[inline]
-    fn lt(&self, other: &@mut T) -> bool { *(*self) < *(*other) }
-    #[inline]
-    fn le(&self, other: &@mut T) -> bool { *(*self) <= *(*other) }
-    #[inline]
-    fn ge(&self, other: &@mut T) -> bool { *(*self) >= *(*other) }
-    #[inline]
-    fn gt(&self, other: &@mut T) -> bool { *(*self) > *(*other) }
-}
-
-#[cfg(not(test))]
 impl<T: TotalOrd> TotalOrd for @T {
     #[inline]
     fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) }
 }
 
 #[cfg(not(test))]
-impl<T: TotalOrd> TotalOrd for @mut T {
-    #[inline]
-    fn cmp(&self, other: &@mut T) -> Ordering { (**self).cmp(*other) }
-}
-
-#[cfg(not(test))]
 impl<T: TotalEq> TotalEq for @T {
     #[inline]
     fn equals(&self, other: &@T) -> bool { (**self).equals(*other) }
 }
 
-#[cfg(not(test))]
-impl<T: TotalEq> TotalEq for @mut T {
-    #[inline]
-    fn equals(&self, other: &@mut T) -> bool { (**self).equals(*other) }
-}
 #[test]
 fn test() {
     let x = @3;
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 8dbec0f63c6..d66d13657fc 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -1079,11 +1079,6 @@ pub fn pow_with_uint<T:NumCast+One+Zero+Div<T,T>+Mul<T,T>>(radix: uint, pow: uin
     total
 }
 
-impl<T: Zero + 'static> Zero for @mut T {
-    fn zero() -> @mut T { @mut Zero::zero() }
-    fn is_zero(&self) -> bool { (**self).is_zero() }
-}
-
 impl<T: Zero + 'static> Zero for @T {
     fn zero() -> @T { @Zero::zero() }
     fn is_zero(&self) -> bool { (**self).is_zero() }
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index 2f9478716a3..e60abed42f2 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -655,13 +655,10 @@ fn test_repr() {
     exact_test(&(~"he\u10f3llo"), "~\"he\\u10f3llo\"");
 
     exact_test(&(@10), "@10");
-    exact_test(&(@mut 10), "@mut 10");
-    exact_test(&((@mut 10, 2)), "(@mut 10, 2)");
     exact_test(&(~10), "~10");
     exact_test(&(&10), "&10");
     let mut x = 10;
     exact_test(&(&mut x), "&mut 10");
-    exact_test(&(@mut [1, 2]), "@mut [1, 2]");
 
     exact_test(&(0 as *()), "(0x0 as *())");
     exact_test(&(0 as *mut ()), "(0x0 as *mut ())");
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 583a1e0657c..ae12f944f9c 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -444,16 +444,20 @@ mod test {
 
     #[test]
     fn heap_cycles() {
+        use cell::RefCell;
         use option::{Option, Some, None};
 
         struct List {
-            next: Option<@mut List>,
+            next: Option<@RefCell<List>>,
         }
 
-        let a = @mut List { next: None };
-        let b = @mut List { next: Some(a) };
+        let a = @RefCell::new(List { next: None });
+        let b = @RefCell::new(List { next: Some(a) });
 
-        a.next = Some(b);
+        {
+            let mut a = a.borrow_mut();
+            a.get().next = Some(b);
+        }
     }
 
     #[test]
diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs
index 9de812ed385..bd1c49c6c24 100644
--- a/src/libstd/to_bytes.rs
+++ b/src/libstd/to_bytes.rs
@@ -319,13 +319,6 @@ impl<A:IterBytes> IterBytes for @A {
     }
 }
 
-impl<A:IterBytes> IterBytes for @mut A {
-    #[inline]
-    fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
-        (**self).iter_bytes(lsb0, f)
-    }
-}
-
 impl<A:IterBytes> IterBytes for Rc<A> {
     #[inline]
     fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {