mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 00:53:48 +00:00
Auto merge of #89769 - jkugelman:must-use-maybe-uninit-new, r=joshtriplett
Add #[must_use] to MaybeUninit::new As discussed in https://github.com/rust-lang/rust/pull/89729#issuecomment-939775659. Parent issue: #89692 r? `@joshtriplett`
This commit is contained in:
commit
02f2b31e61
@ -291,6 +291,7 @@ impl<T> MaybeUninit<T> {
|
||||
/// [`assume_init`]: MaybeUninit::assume_init
|
||||
#[stable(feature = "maybe_uninit", since = "1.36.0")]
|
||||
#[rustc_const_stable(feature = "const_maybe_uninit", since = "1.36.0")]
|
||||
#[must_use = "use `forget` to avoid running Drop code"]
|
||||
#[inline(always)]
|
||||
pub const fn new(val: T) -> MaybeUninit<T> {
|
||||
MaybeUninit { value: ManuallyDrop::new(val) }
|
||||
|
Loading…
Reference in New Issue
Block a user