diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-07 09:20:36 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-07 09:20:36 +0900 |
| commit | 12ffe5ffdd51d0f4c860d064d7e70912cbbf3863 (patch) | |
| tree | 0de72f354281dd04221f2258dbcaa78055343286 /src/libcore | |
| parent | 1988f28009479484362f7718371618a9c1d31b84 (diff) | |
| parent | bb37d0078750b760f013bfa706fe19d4d823b8df (diff) | |
Rollup merge of #66044 - RalfJung:uninit-lint, r=oli-obk
Improve uninit/zeroed lint * Also warn when creating a raw pointer with a NULL vtable. * Also identify `MaybeUninit::uninit().assume_init()` and `MaybeUninit::zeroed().assume_init()` as dangerous.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/mem/maybe_uninit.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 51ba260589f..03093139bc2 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -440,6 +440,7 @@ impl<T> MaybeUninit<T> { /// ``` #[stable(feature = "maybe_uninit", since = "1.36.0")] #[inline(always)] + #[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "assume_init")] pub unsafe fn assume_init(self) -> T { intrinsics::panic_if_uninhabited::<T>(); ManuallyDrop::into_inner(self.value) |
