Skip to content

Commit 5e8f95b

Browse files
committed
Re-add some justification
1 parent 73a30f8 commit 5e8f95b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/mem/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ pub unsafe fn zeroed<T>() -> T {
666666
/// As the [`assume_init` documentation][assume_init] explains,
667667
/// [the Rust compiler assumes][inv] that values are properly initialized.
668668
///
669+
/// Truly uninitialized memory like what gets returned here
670+
/// is special in that the compiler knows that it does not have a fixed value.
671+
/// This makes it undefined behavior to have uninitialized data in a variable even
672+
/// if that variable has an integer type.
673+
///
669674
/// Therefore, it is immediate undefined behavior to call this function on nearly all types,
670675
/// including integer types and arrays of integer types, and even if the result is unused.
671676
///

0 commit comments

Comments
 (0)