From b6e516859adc2eb0638a50677f73691f50ea9aca Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 30 Dec 2013 17:49:00 -0800 Subject: [PATCH] libstd: Remove all support code related to `@mut` --- src/libextra/serialize.rs | 12 ------------ src/libstd/clone.rs | 31 ------------------------------- src/libstd/default.rs | 4 ---- src/libstd/managed.rs | 38 -------------------------------------- src/libstd/num/mod.rs | 5 ----- src/libstd/repr.rs | 3 --- src/libstd/to_bytes.rs | 7 ------- 7 files changed, 100 deletions(-) diff --git a/src/libextra/serialize.rs b/src/libextra/serialize.rs index 6b298d877da..e7ccb91fb75 100644 --- a/src/libextra/serialize.rs +++ b/src/libextra/serialize.rs @@ -426,18 +426,6 @@ impl + 'static> Decodable for @T { } } -impl> Encodable for @mut T { - fn encode(&self, s: &mut S) { - (**self).encode(s) - } -} - -impl + 'static> Decodable for @mut T { - fn decode(d: &mut D) -> @mut T { - @mut Decodable::decode(d) - } -} - impl<'a, S:Encoder,T:Encodable> Encodable for &'a [T] { fn encode(&self, s: &mut S) { s.emit_seq(self.len(), |s| { 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 Clone for @T { fn clone(&self) -> @T { *self } } -impl 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 DeepClone for @T { fn deep_clone(&self) -> @T { @(**self).deep_clone() } } -// FIXME: #6525: should also be implemented for `T: Send + DeepClone` -impl 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 { @@ -239,23 +225,6 @@ fn test_managed_clone() { assert_eq!(a, b); } -#[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; 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 Default for @mut T { - fn default() -> @mut T { @mut Default::default() } -} - impl Default for @T { fn default() -> @T { @Default::default() } } 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(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(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 Eq for @T { #[inline] @@ -46,14 +39,6 @@ impl Eq for @T { fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) } } -#[cfg(not(test))] -impl 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 Ord for @T { #[inline] @@ -66,41 +51,18 @@ impl Ord for @T { fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) } } -#[cfg(not(test))] -impl 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 TotalOrd for @T { #[inline] fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) } } -#[cfg(not(test))] -impl TotalOrd for @mut T { - #[inline] - fn cmp(&self, other: &@mut T) -> Ordering { (**self).cmp(*other) } -} - #[cfg(not(test))] impl TotalEq for @T { #[inline] fn equals(&self, other: &@T) -> bool { (**self).equals(*other) } } -#[cfg(not(test))] -impl 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+Mul>(radix: uint, pow: uin total } -impl Zero for @mut T { - fn zero() -> @mut T { @mut Zero::zero() } - fn is_zero(&self) -> bool { (**self).is_zero() } -} - impl 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/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 IterBytes for @A { } } -impl IterBytes for @mut A { - #[inline] - fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { - (**self).iter_bytes(lsb0, f) - } -} - impl IterBytes for Rc { #[inline] fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {