From 397a47852849ac2e286508f2315e695f5d8168cf Mon Sep 17 00:00:00 2001 From: Matthijs Hofstra Date: Wed, 3 Apr 2013 18:28:44 +0200 Subject: [PATCH] Unstable didn't need transmute_mut after all. --- src/libcore/unstable.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/unstable.rs b/src/libcore/unstable.rs index e2b57a8dd3eda..c717c1692a8c5 100644 --- a/src/libcore/unstable.rs +++ b/src/libcore/unstable.rs @@ -120,9 +120,9 @@ impl Drop for ArcDestruct{ fn finalize(&self) { unsafe { do task::unkillable { - let data: ~ArcData = cast::reinterpret_cast(&self.data); + let mut data: ~ArcData = cast::reinterpret_cast(&self.data); let new_count = - intrinsics::atomic_xsub(cast::transmute_mut(&data.count), 1) - 1; + intrinsics::atomic_xsub(&mut data.count, 1) - 1; assert!(new_count >= 0); if new_count == 0 { // drop glue takes over. @@ -185,8 +185,8 @@ pub unsafe fn get_shared_immutable_state<'a,T:Owned>( pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) -> SharedMutableState { unsafe { - let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); - let new_count = intrinsics::atomic_xadd(cast::transmute_mut(&ptr.count), 1) + 1; + let mut ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); + let new_count = intrinsics::atomic_xadd(&mut ptr.count, 1) + 1; assert!(new_count >= 2); cast::forget(ptr); }