From 7c77adad3e7db38d11a4859cc6ff3544cc26a1c2 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 21:30:24 +0900 Subject: [PATCH] Allow deprecated mem::uninitialized --- crossbeam-epoch/src/deferred.rs | 6 ++++++ crossbeam-epoch/src/sync/queue.rs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs index 574b954ac..3d22ee633 100644 --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -36,6 +36,9 @@ impl Deferred { unsafe { if size <= mem::size_of::() && align <= mem::align_of::() { + // 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); @@ -51,6 +54,9 @@ impl Deferred { } } else { let b: Box = 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, b); diff --git a/crossbeam-epoch/src/sync/queue.rs b/crossbeam-epoch/src/sync/queue.rs index 671d046ce..6fe0bef37 100644 --- a/crossbeam-epoch/src/sync/queue.rs +++ b/crossbeam-epoch/src/sync/queue.rs @@ -46,6 +46,9 @@ impl Queue { 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(),