diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-05-06 00:42:54 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-05-10 22:51:06 -0400 |
| commit | 998fececd6516fa07d0cd0a0c4607ddef0bc40f0 (patch) | |
| tree | 9597e6c2f0592136086f722338b95196f71104ec /src/libstd/rc.rs | |
| parent | 7d22437ecdc5b52f8517ffde6207347739b26553 (diff) | |
| download | rust-998fececd6516fa07d0cd0a0c4607ddef0bc40f0.tar.gz rust-998fececd6516fa07d0cd0a0c4607ddef0bc40f0.zip | |
Stop using the '<->' operator
Diffstat (limited to 'src/libstd/rc.rs')
| -rw-r--r-- | src/libstd/rc.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs index 9eab1adde47..0c0f11fc9f0 100644 --- a/src/libstd/rc.rs +++ b/src/libstd/rc.rs @@ -17,6 +17,7 @@ destruction. They are restricted to containing `Owned` types in order to prevent use core::libc::{c_void, size_t, malloc, free}; use core::unstable::intrinsics; +use core::util; struct RcBox<T> { value: T, @@ -52,8 +53,7 @@ impl<T: Owned> Drop for Rc<T> { unsafe { (*self.ptr).count -= 1; if (*self.ptr).count == 0 { - let mut x = intrinsics::uninit(); - x <-> *self.ptr; + util::replace_ptr(self.ptr, intrinsics::uninit()); free(self.ptr as *c_void) } } @@ -67,8 +67,7 @@ impl<T: Owned> Drop for Rc<T> { unsafe { (*self.ptr).count -= 1; if (*self.ptr).count == 0 { - let mut x = intrinsics::init(); - x <-> *self.ptr; + util::replace_ptr(self.ptr, intrinsics::init()); free(self.ptr as *c_void) } } @@ -111,13 +110,6 @@ mod test_rc { } } -#[abi = "rust-intrinsic"] -extern "rust-intrinsic" mod rusti { - fn init<T>() -> T; - #[cfg(not(stage0))] - fn uninit<T>() -> T; -} - #[deriving(Eq)] enum Borrow { Mutable, @@ -179,8 +171,7 @@ impl<T: Owned> Drop for RcMut<T> { unsafe { (*self.ptr).count -= 1; if (*self.ptr).count == 0 { - let mut x = rusti::uninit(); - x <-> *self.ptr; + util::replace_ptr(self.ptr, intrinsics::uninit()); free(self.ptr as *c_void) } } @@ -194,8 +185,7 @@ impl<T: Owned> Drop for RcMut<T> { unsafe { (*self.ptr).count -= 1; if (*self.ptr).count == 0 { - let mut x = rusti::init(); - x <-> *self.ptr; + util::replace_ptr(self.ptr, intrinsics::init()); free(self.ptr as *c_void) } } |
