diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-07-26 19:36:26 -0700 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2019-07-29 12:17:49 -0700 |
| commit | 6fae7f807146e400fa2bbd1c44768d9bcaa57c4c (patch) | |
| tree | 83c3496735c01f5d7b0f4408b4c8d2f4e12761a3 /src/libcore/mem | |
| parent | c43753f910aae000f8bcb0a502407ea332afc74b (diff) | |
| download | rust-6fae7f807146e400fa2bbd1c44768d9bcaa57c4c.tar.gz rust-6fae7f807146e400fa2bbd1c44768d9bcaa57c4c.zip | |
Wrap promoted generator fields in MaybeUninit
This prevents uninhabited fields from "infecting" the abi and largest_niche of the generator layout. This fixes a latent bug, where an uninhabited field could be promoted to the generator prefix and cause the entire generator to become uninhabited.
Diffstat (limited to 'src/libcore/mem')
| -rw-r--r-- | src/libcore/mem/maybe_uninit.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 2e88db8df11..1a37326c132 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -208,6 +208,8 @@ use crate::mem::ManuallyDrop; /// guarantee may evolve. #[allow(missing_debug_implementations)] #[stable(feature = "maybe_uninit", since = "1.36.0")] +// Lang item so we can wrap other types in it. This is useful for generators. +#[cfg_attr(not(bootstrap), lang = "maybe_uninit")] #[derive(Copy)] #[repr(transparent)] pub union MaybeUninit<T> { |
