diff options
| author | bors <bors@rust-lang.org> | 2021-10-12 07:02:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-12 07:02:53 +0000 |
| commit | 02f2b31e61390b09c1012379c70b7d0bc0f65df9 (patch) | |
| tree | 815927bf6c043fadd37c047966c2934195edd839 | |
| parent | ffdf18d1447b57faafded06a887b6dae1f7293c7 (diff) | |
| parent | b0b09f0842734b6594dbe3aa24cf4e01edcb9f49 (diff) | |
| download | rust-02f2b31e61390b09c1012379c70b7d0bc0f65df9.tar.gz rust-02f2b31e61390b09c1012379c70b7d0bc0f65df9.zip | |
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`
| -rw-r--r-- | library/core/src/mem/maybe_uninit.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index b9772eaa678..624e8795502 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -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) } |
