-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJung
RemoveZsts: don't touch unions This should fix a Miri ICE r? `@RalfJung`
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/mir-opt/remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// MIR for `get_union` after RemoveZsts | ||
|
||
fn get_union() -> Foo { | ||
let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:12:19: 12:22 | ||
let mut _1: (); // in scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:13:14: 13:16 | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:13:14: 13:16 | ||
(_0.0: ()) = move _1; // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:13:5: 13:18 | ||
StorageDead(_1); // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:13:17: 13:18 | ||
return; // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:14:2: 14:2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// compile-flags: -Zmir-opt-level=3 | ||
|
||
// Ensure RemoveZsts doesn't remove ZST assignments to union fields, | ||
// which causes problems in Miri. | ||
|
||
union Foo { | ||
x: (), | ||
y: u64, | ||
} | ||
|
||
// EMIT_MIR remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir | ||
fn get_union() -> Foo { | ||
Foo { x: () } | ||
} | ||
|
||
|
||
fn main() { | ||
get_union(); | ||
} |