libstd: Remove all support code related to @mut
This commit is contained in:
parent
e095889e4e
commit
b6e516859a
@ -426,18 +426,6 @@ fn decode(d: &mut D) -> @T {
|
||||
}
|
||||
}
|
||||
|
||||
impl<S:Encoder,T:Encodable<S>> Encodable<S> for @mut T {
|
||||
fn encode(&self, s: &mut S) {
|
||||
(**self).encode(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @mut T {
|
||||
fn decode(d: &mut D) -> @mut T {
|
||||
@mut Decodable::decode(d)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, S:Encoder,T:Encodable<S>> Encodable<S> for &'a [T] {
|
||||
fn encode(&self, s: &mut S) {
|
||||
s.emit_seq(self.len(), |s| {
|
||||
|
@ -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 {
|
||||
@ -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;
|
||||
|
@ -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() }
|
||||
}
|
||||
|
@ -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]
|
||||
@ -46,14 +39,6 @@ fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
|
||||
fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
|
||||
}
|
||||
|
||||
#[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]
|
||||
@ -66,41 +51,18 @@ fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
|
||||
fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
|
||||
}
|
||||
|
||||
#[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;
|
||||
|
@ -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() }
|
||||
|
@ -655,13 +655,10 @@ fn exact_test<T>(t: &T, e:&str) {
|
||||
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 ())");
|
||||
|
@ -319,13 +319,6 @@ fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user