Skip to content

Commit

Permalink
Unstable didn't need transmute_mut after all.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiez committed Apr 3, 2013
1 parent c16919d commit 397a478
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ impl<T> Drop for ArcDestruct<T>{
fn finalize(&self) {
unsafe {
do task::unkillable {
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
let mut data: ~ArcData<T> = 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.
Expand Down Expand Up @@ -185,8 +185,8 @@ pub unsafe fn get_shared_immutable_state<'a,T:Owned>(
pub unsafe fn clone_shared_mutable_state<T:Owned>(rc: &SharedMutableState<T>)
-> SharedMutableState<T> {
unsafe {
let ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
let new_count = intrinsics::atomic_xadd(cast::transmute_mut(&ptr.count), 1) + 1;
let mut ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
let new_count = intrinsics::atomic_xadd(&mut ptr.count, 1) + 1;
assert!(new_count >= 2);
cast::forget(ptr);
}
Expand Down

5 comments on commit 397a478

@bors
Copy link
Contributor

@bors bors commented on 397a478 Apr 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at Thiez@397a478

@bors
Copy link
Contributor

@bors bors commented on 397a478 Apr 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Thiez/rust/de-mutfielding = 397a478 into auto

@bors
Copy link
Contributor

@bors bors commented on 397a478 Apr 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thiez/rust/de-mutfielding = 397a478 merged ok, testing candidate = 17ab718

@bors
Copy link
Contributor

@bors bors commented on 397a478 Apr 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 397a478 Apr 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 17ab718

Please sign in to comment.