Don't imply function pointers are references

Co-authored-by: David Tolnay <dtolnay@gmail.com>
This commit is contained in:
Poliorcetics 2020-06-17 03:30:41 +02:00 committed by GitHub
parent 15cd51af5e
commit e75fa896ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -583,7 +583,7 @@ pub const fn needs_drop<T>() -> 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<T>() -> 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")]