]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / ui / borrowck / reassignment_immutable_fields_overlapping.rs
1 // This should never be allowed -- `foo.a` and `foo.b` are
2 // overlapping, so since `x` is not `mut` we should not permit
3 // reassignment.
4
5 union Foo {
6     a: u32,
7     b: u32,
8 }
9
10 unsafe fn overlapping_fields() {
11     let x: Foo;
12     x.a = 1;  //~ ERROR
13     x.b = 22; //~ ERROR
14 }
15
16 fn main() { }