Skip to content

Commit

Permalink
Auto merge of rust-lang#89769 - jkugelman:must-use-maybe-uninit-new, …
Browse files Browse the repository at this point in the history
…r=joshtriplett

Add #[must_use] to MaybeUninit::new

As discussed in rust-lang#89729 (comment).

Parent issue: rust-lang#89692

r? `@joshtriplett`
  • Loading branch information
bors committed Oct 12, 2021
2 parents ffdf18d + b0b09f0 commit 02f2b31
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit 02f2b31

Please sign in to comment.