File tree 1 file changed +5
-1
lines changed
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 {
510
510
/// **This function is deprecated.** Use [`MaybeUninit<T>`] instead.
511
511
///
512
512
/// 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.
514
516
/// As a consequence, calling e.g. `mem::uninitialized::<bool>()` causes immediate
515
517
/// undefined behavior for returning a `bool` that is not definitely either `true`
516
518
/// or `false`. Worse, truly uninitialized memory like what gets returned here
@@ -521,6 +523,8 @@ pub unsafe fn zeroed<T>() -> T {
521
523
/// until they are, it is advisable to avoid them.)
522
524
///
523
525
/// [`MaybeUninit<T>`]: union.MaybeUninit.html
526
+ /// [uninit]: union.MaybeUninit.html#method.uninit
527
+ /// [assume_init]: union.MaybeUninit.html#method.assume_init
524
528
/// [inv]: union.MaybeUninit.html#initialization-invariant
525
529
#[ inline]
526
530
#[ rustc_deprecated( since = "1.39.0" , reason = "use `mem::MaybeUninit` instead" ) ]
You can’t perform that action at this time.
0 commit comments