From e75fa896ba53eb5fc5c3dd2741101f377488c2db Mon Sep 17 00:00:00 2001 From: Poliorcetics Date: Wed, 17 Jun 2020 03:30:41 +0200 Subject: Don't imply function pointers are references Co-authored-by: David Tolnay --- src/libcore/mem/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index 226454561f6..70083ffa4be 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -583,7 +583,7 @@ pub const fn needs_drop() -> bool { /// /// There is no guarantee that an all-zero byte-pattern represents a valid value /// of some type `T`. For example, the all-zero byte-pattern is not a valid value -/// for reference types (`&T`, `&mut T` and functions pointers). Using `zeroed` on +/// for reference types (`&T`, `&mut T`) and functions pointers. Using `zeroed` on /// such types on such types causes immediate [undefined behavior][ub] because /// [the Rust compiler assumes][inv] that there always is a valid value in a /// variable it considers initialized. @@ -613,7 +613,7 @@ pub const fn needs_drop() -> bool { /// use std::mem; /// /// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior! -/// let _y: fn() = unsafe { mem::zeroed() }; // And again ! +/// let _y: fn() = unsafe { mem::zeroed() }; // And again! /// ``` #[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5