Skip to content

Commit 397a478

Browse files
committed
Unstable didn't need transmute_mut after all.
1 parent c16919d commit 397a478

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/unstable.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ impl<T> Drop for ArcDestruct<T>{
120120
fn finalize(&self) {
121121
unsafe {
122122
do task::unkillable {
123-
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
123+
let mut data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
124124
let new_count =
125-
intrinsics::atomic_xsub(cast::transmute_mut(&data.count), 1) - 1;
125+
intrinsics::atomic_xsub(&mut data.count, 1) - 1;
126126
assert!(new_count >= 0);
127127
if new_count == 0 {
128128
// drop glue takes over.
@@ -185,8 +185,8 @@ pub unsafe fn get_shared_immutable_state<'a,T:Owned>(
185185
pub unsafe fn clone_shared_mutable_state<T:Owned>(rc: &SharedMutableState<T>)
186186
-> SharedMutableState<T> {
187187
unsafe {
188-
let ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
189-
let new_count = intrinsics::atomic_xadd(cast::transmute_mut(&ptr.count), 1) + 1;
188+
let mut ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
189+
let new_count = intrinsics::atomic_xadd(&mut ptr.count, 1) + 1;
190190
assert!(new_count >= 2);
191191
cast::forget(ptr);
192192
}

0 commit comments

Comments
 (0)