diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 20be406c0e5..d2dd2941d59 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -666,6 +666,11 @@ pub unsafe fn zeroed() -> T { /// As the [`assume_init` documentation][assume_init] explains, /// [the Rust compiler assumes][inv] that values are properly initialized. /// +/// Truly uninitialized memory like what gets returned here +/// is special in that the compiler knows that it does not have a fixed value. +/// This makes it undefined behavior to have uninitialized data in a variable even +/// if that variable has an integer type. +/// /// Therefore, it is immediate undefined behavior to call this function on nearly all types, /// including integer types and arrays of integer types, and even if the result is unused. ///