Skip to content

Commit ae4961a

Browse files
committedAug 26, 2022
Re-add some justification
1 parent 584d1bd commit ae4961a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎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)
Please sign in to comment.