blob: d7aad6c01bd26a007415c04ed30d96052aa6cbca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// This should never be allowed -- `foo.a` and `foo.b` are
// overlapping, so since `x` is not `mut` we should not permit
// reassignment.
union Foo {
a: u32,
b: u32,
}
unsafe fn overlapping_fields() {
let x: Foo;
x.a = 1; //~ ERROR
x.b = 22; //~ ERROR
}
fn main() { }
|