From f3eede6870c817e2e22782ad08d31fcaa8c6b640 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 6 Feb 2019 11:14:12 +0100 Subject: [PATCH] fix doctests --- src/libcore/mem.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 18302e36ff76..930fe737a726 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1045,7 +1045,7 @@ impl DerefMut for ManuallyDrop { /// ```rust,no_run /// use std::mem; /// -/// let x: &i32 = mem::zeroed(); // undefined behavior! +/// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior! /// ``` /// This is exploited by the compiler for various optimizations, such as eliding /// run-time checks and optimizing `enum` layout. @@ -1058,6 +1058,7 @@ impl DerefMut for ManuallyDrop { /// it is a signal to the compiler indicating that the data here might *not* /// be initialized: /// ```rust +/// #![feature(maybe_uninit)] /// use std::mem::MaybeUninit; /// /// // Create an explicitly uninitialized reference.