We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents dfec47f + 2a5a668 commit 75e8d65Copy full SHA for 75e8d65
library/core/src/mem/maybe_uninit.rs
@@ -394,10 +394,11 @@ impl<T> MaybeUninit<T> {
394
/// // This is undefined behavior. ⚠️
395
/// ```
396
#[stable(feature = "maybe_uninit", since = "1.36.0")]
397
+ #[rustc_const_unstable(feature = "const_maybe_uninit_zeroed", issue = "91850")]
398
#[must_use]
399
#[inline]
400
#[rustc_diagnostic_item = "maybe_uninit_zeroed"]
- pub fn zeroed() -> MaybeUninit<T> {
401
+ pub const fn zeroed() -> MaybeUninit<T> {
402
let mut u = MaybeUninit::<T>::uninit();
403
// SAFETY: `u.as_mut_ptr()` points to allocated memory.
404
unsafe {
0 commit comments