diff options
| author | bors <bors@rust-lang.org> | 2015-02-23 20:47:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-23 20:47:30 +0000 |
| commit | 91a5a1ab4ad054c8dccf49f6f409542f82683cfc (patch) | |
| tree | 1c2a90b8e1aac6793a0fbf6350778a5b9ac65dae /src/libstd/sync | |
| parent | f0f7ca27de6b4e03f30012656dad270cda55a363 (diff) | |
| parent | ee6f2a1ad6ab79ed954cd96fff6eaddcdfb6a043 (diff) | |
| download | rust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.tar.gz rust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.zip | |
Auto merge of #22724 - Manishearth:rollup, r=alexcrichton
Seems to pass `check-stage1`, but I had to tweak some things so it's going through the test gauntlet again.
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mpsc/mpsc_queue.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/spsc_queue.rs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 6eb7c8c5961..59fa2e6bc9a 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -44,8 +44,8 @@ pub use self::PopResult::*; use core::prelude::*; +use alloc::boxed; use alloc::boxed::Box; -use core::mem; use core::ptr; use core::cell::UnsafeCell; @@ -82,7 +82,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T> Node<T> { unsafe fn new(v: Option<T>) -> *mut Node<T> { - mem::transmute(box Node { + boxed::into_raw(box Node { next: AtomicPtr::new(ptr::null_mut()), value: v, }) @@ -129,7 +129,7 @@ impl<T: Send> Queue<T> { assert!((*tail).value.is_none()); assert!((*next).value.is_some()); let ret = (*next).value.take().unwrap(); - let _: Box<Node<T>> = mem::transmute(tail); + let _: Box<Node<T>> = Box::from_raw(tail); return Data(ret); } @@ -146,7 +146,7 @@ impl<T: Send> Drop for Queue<T> { let mut cur = *self.tail.get(); while !cur.is_null() { let next = (*cur).next.load(Ordering::Relaxed); - let _: Box<Node<T>> = mem::transmute(cur); + let _: Box<Node<T>> = Box::from_raw(cur); cur = next; } } diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index f111e13975f..7b5c614536d 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -37,8 +37,8 @@ use core::prelude::*; +use alloc::boxed; use alloc::boxed::Box; -use core::mem; use core::ptr; use core::cell::UnsafeCell; @@ -81,7 +81,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T: Send> Node<T> { fn new() -> *mut Node<T> { unsafe { - mem::transmute(box Node { + boxed::into_raw(box Node { value: None, next: AtomicPtr::new(ptr::null_mut::<Node<T>>()), }) @@ -200,7 +200,7 @@ impl<T: Send> Queue<T> { .next.store(next, Ordering::Relaxed); // We have successfully erased all references to 'tail', so // now we can safely drop it. - let _: Box<Node<T>> = mem::transmute(tail); + let _: Box<Node<T>> = Box::from_raw(tail); } } return ret; @@ -233,7 +233,7 @@ impl<T: Send> Drop for Queue<T> { let mut cur = *self.first.get(); while !cur.is_null() { let next = (*cur).next.load(Ordering::Relaxed); - let _n: Box<Node<T>> = mem::transmute(cur); + let _n: Box<Node<T>> = Box::from_raw(cur); cur = next; } } |
