mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
16 lines
381 B
Rust
16 lines
381 B
Rust
// revisions: mir thir
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
union Foo {
|
|
bar: i8,
|
|
baz: u8,
|
|
}
|
|
|
|
fn main() {
|
|
let foo = Foo { bar: 5 };
|
|
let a = foo.bar; //~ ERROR access to union field is unsafe and requires unsafe function or block
|
|
let b = foo.baz; //~ ERROR access to union field is unsafe and requires unsafe function or block
|
|
}
|