summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsafe/union_access_through_block.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/unsafe/union_access_through_block.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/unsafe/union_access_through_block.rs b/src/test/ui/unsafe/union_access_through_block.rs
new file mode 100644
index 000000000..e4c0976b8
--- /dev/null
+++ b/src/test/ui/unsafe/union_access_through_block.rs
@@ -0,0 +1,18 @@
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#[derive(Copy, Clone)]
+pub struct Foo { a: bool }
+
+pub union Bar {
+ a: Foo,
+ b: u32,
+}
+pub fn baz(mut bar: Bar) {
+ unsafe {
+ { bar.a }.a = true;
+ }
+}
+
+fn main() {}