Skip to content

Commit

Permalink
Allow deprecated mem::uninitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 16, 2019
1 parent 4d952ef commit 7c77ada
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crossbeam-epoch/src/deferred.rs
Expand Up @@ -36,6 +36,9 @@ impl Deferred {

unsafe {
if size <= mem::size_of::<Data>() && align <= mem::align_of::<Data>() {
// TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+,
// replace this with `mem::MaybeUninit`.
#[allow(deprecated)]
let mut data: Data = mem::uninitialized();
ptr::write(&mut data as *mut Data as *mut F, f);

Expand All @@ -51,6 +54,9 @@ impl Deferred {
}
} else {
let b: Box<F> = Box::new(f);
// TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+,
// replace this with `mem::MaybeUninit`.
#[allow(deprecated)]
let mut data: Data = mem::uninitialized();
ptr::write(&mut data as *mut Data as *mut Box<F>, b);

Expand Down
3 changes: 3 additions & 0 deletions crossbeam-epoch/src/sync/queue.rs
Expand Up @@ -46,6 +46,9 @@ impl<T> Queue<T> {
head: CachePadded::new(Atomic::null()),
tail: CachePadded::new(Atomic::null()),
};
// TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+,
// replace this with `mem::MaybeUninit`.
#[allow(deprecated)]
let sentinel = Owned::new(Node {
data: unsafe { mem::uninitialized() },
next: Atomic::null(),
Expand Down

0 comments on commit 7c77ada

Please sign in to comment.