diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2019-10-25 21:24:50 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2019-10-25 21:41:24 +0200 |
| commit | 853651430824b49ab1e995b6bdcf2705badb99b1 (patch) | |
| tree | 16b1ef9073026db0621a420a674123a26f03cefe /example | |
| parent | dda5ea883a2191b16e08ba1a455a5776acbe57d0 (diff) | |
| download | rust-853651430824b49ab1e995b6bdcf2705badb99b1.tar.gz rust-853651430824b49ab1e995b6bdcf2705badb99b1.zip | |
Rustup to rustc 1.40.0-nightly (10a52c25c 2019-10-24)
Diffstat (limited to 'example')
| -rw-r--r-- | example/mini_core.rs | 13 | ||||
| -rw-r--r-- | example/mini_core_hello_world.rs | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs index a271cb6e62e..1d8942c6ab2 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -1,6 +1,6 @@ #![feature( no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types, - untagged_unions, decl_macro, rustc_attrs + untagged_unions, decl_macro, rustc_attrs, transparent_unions )] #![no_core] #![allow(dead_code)] @@ -448,10 +448,17 @@ pub trait Drop { fn drop(&mut self); } -#[allow(unions_with_drop_fields)] +#[lang = "manually_drop"] +#[repr(transparent)] +pub struct ManuallyDrop<T: ?Sized> { + pub value: T, +} + +#[lang = "maybe_uninit"] +#[repr(transparent)] pub union MaybeUninit<T> { pub uninit: (), - pub value: T, + pub value: ManuallyDrop<T>, } pub mod intrinsics { diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index 76387e8c036..fdc71af4437 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -196,7 +196,7 @@ fn main() { } unsafe fn uninitialized<T>() -> T { - MaybeUninit { uninit: () }.value + MaybeUninit { uninit: () }.value.value } zeroed::<(u8, u8)>(); |
