File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -510,7 +510,9 @@ pub unsafe fn zeroed<T>() -> T {
510510/// **This function is deprecated.** Use [`MaybeUninit<T>`] instead.
511511///
512512/// The reason for deprecation is that the function basically cannot be used
513- /// correctly: [the Rust compiler assumes][inv] that values are properly initialized.
513+ /// correctly: it has the same effect as [`MaybeUninit::uninit().assume_init()`][uninit].
514+ /// As the [`assume_init` documentation][assume_init] explains,
515+ /// [the Rust compiler assumes][inv] that values are properly initialized.
514516/// As a consequence, calling e.g. `mem::uninitialized::<bool>()` causes immediate
515517/// undefined behavior for returning a `bool` that is not definitely either `true`
516518/// or `false`. Worse, truly uninitialized memory like what gets returned here
@@ -521,6 +523,8 @@ pub unsafe fn zeroed<T>() -> T {
521523/// until they are, it is advisable to avoid them.)
522524///
523525/// [`MaybeUninit<T>`]: union.MaybeUninit.html
526+ /// [uninit]: union.MaybeUninit.html#method.uninit
527+ /// [assume_init]: union.MaybeUninit.html#method.assume_init
524528/// [inv]: union.MaybeUninit.html#initialization-invariant
525529#[ inline]
526530#[ rustc_deprecated( since = "1.39.0" , reason = "use `mem::MaybeUninit` instead" ) ]
You can’t perform that action at this time.
0 commit comments