blob: 2f14826fa1253171753f86d81c7f2eb75b2a855d [file] [log] [blame]
error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-union-borrow.rs:37:23
|
LL | let ra = &u.a;
| ---- immutable borrow occurs here
LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
| ^^^^^^^^ mutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
LL | drop(ra);
| -- borrow later used here
error[E0506]: cannot assign to `u.a` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:43:13
|
LL | let ra = &u.a;
| ---- borrow of `u.a` occurs here
LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
| ^^^^^^^ assignment to borrowed `u.a` occurs here
LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
LL | drop(ra);
| -- borrow later used here
error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-union-borrow.rs:60:23
|
LL | let ra = &u.a;
| ---- immutable borrow occurs here
LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
| ^^^^^^^^ mutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable
LL | drop(ra);
| -- borrow later used here
error[E0506]: cannot assign to `u.b` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:66:13
|
LL | let ra = &u.a;
| ---- borrow of `u.b` occurs here
LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
| ^^^^^^^ assignment to borrowed `u.b` occurs here
LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
LL | drop(ra);
| -- borrow later used here
error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-union-borrow.rs:73:22
|
LL | let rma = &mut u.a;
| -------- mutable borrow occurs here
LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
| ^^^^ immutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
LL | drop(rma);
| --- borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
--> $DIR/borrowck-union-borrow.rs:79:21
|
LL | let ra = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
| ^^^ use of borrowed `u.a`
LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
LL | drop(ra);
| -- borrow later used here
error[E0499]: cannot borrow `u.a` as mutable more than once at a time
--> $DIR/borrowck-union-borrow.rs:85:24
|
LL | let rma = &mut u.a;
| -------- first mutable borrow occurs here
LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
| ^^^^^^^^ second mutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time
LL | drop(rma);
| --- borrow later used here
error[E0506]: cannot assign to `u.a` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:91:13
|
LL | let rma = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
| ^^^^^^^ assignment to borrowed `u.a` occurs here
LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
LL | drop(rma);
| --- borrow later used here
error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-union-borrow.rs:98:22
|
LL | let rma = &mut u.a;
| -------- mutable borrow occurs here
LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
| ^^^^ immutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable
LL | drop(rma);
| --- borrow later used here
error[E0503]: cannot use `u.b` because it was mutably borrowed
--> $DIR/borrowck-union-borrow.rs:104:21
|
LL | let ra = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
| ^^^ use of borrowed `u.a`
...
LL | drop(ra);
| -- borrow later used here
error[E0499]: cannot borrow `u.b` as mutable more than once at a time
--> $DIR/borrowck-union-borrow.rs:111:24
|
LL | let rma = &mut u.a;
| -------- first mutable borrow occurs here
LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
| ^^^^^^^^ second mutable borrow occurs here
LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time
LL | drop(rma);
| --- borrow later used here
error[E0506]: cannot assign to `u.b` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:117:13
|
LL | let rma = &mut u.a;
| -------- borrow of `u.b` occurs here
LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
| ^^^^^^^ assignment to borrowed `u.b` occurs here
LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
LL | drop(rma);
| --- borrow later used here
error: aborting due to 12 previous errors
Some errors occurred: E0499, E0502, E0503, E0506.
For more information about an error, try `rustc --explain E0499`.