diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-21 22:00:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-21 22:00:45 +0200 |
| commit | aba84894d1879a7429d5bc20d0bfdca3471685de (patch) | |
| tree | 5c11f19bd3b62b335a5a189f49b0ef2a6c3bc2f2 /src/test/ui/self | |
| parent | 10f12fe3e73f3b6f7e6d6f8bbd87b1a8b4e74a07 (diff) | |
| parent | 875bdd5dbe663a6dafd785b86c8964a90653eeb7 (diff) | |
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Change untagged_unions to not allow union fields with drop This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass. Change untagged_unions to not allow union fields with drop Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar). The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature. Tracking issue: https://github.com/rust-lang/rust/issues/55149
Diffstat (limited to 'src/test/ui/self')
| -rw-r--r-- | src/test/ui/self/self-in-typedefs.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test/ui/self/self-in-typedefs.rs b/src/test/ui/self/self-in-typedefs.rs index 73f23a9cc17..3b1eb9e1dfa 100644 --- a/src/test/ui/self/self-in-typedefs.rs +++ b/src/test/ui/self/self-in-typedefs.rs @@ -3,7 +3,8 @@ #![feature(untagged_unions)] #![allow(dead_code)] -#![allow(unions_with_drop_fields)] + +use std::mem::ManuallyDrop; enum A<'a, T: 'a> where @@ -26,6 +27,14 @@ where Self: Send, T: PartialEq<Self> { foo: &'a Self, + bar: ManuallyDrop<T>, +} + +union D<'a, T: 'a> +where + Self: Send, T: PartialEq<Self> + Copy +{ + foo: &'a Self, bar: T, } |
