Don't imply function pointers are references
Co-authored-by: David Tolnay <dtolnay@gmail.com>
This commit is contained in:
parent
15cd51af5e
commit
e75fa896ba
|
@ -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")]
|
||||
|
|
Loading…
Reference in New Issue