1 error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-union-borrow.rs:25:23
5 | ---- immutable borrow occurs here
6 LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
7 | ^^^^^^^^ mutable borrow occurs here
9 | -- immutable borrow later used here
11 error[E0506]: cannot assign to `u.a` because it is borrowed
12 --> $DIR/borrowck-union-borrow.rs:30:13
15 | ---- borrow of `u.a` occurs here
16 LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed
17 | ^^^^^^^ assignment to borrowed `u.a` occurs here
19 | -- borrow later used here
21 error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrowed as immutable (via `u.a`)
22 --> $DIR/borrowck-union-borrow.rs:46:23
25 | ---- immutable borrow occurs here (via `u.a`)
26 LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
27 | ^^^^^^^^ mutable borrow occurs here (via `u.b`)
29 | -- immutable borrow later used here
31 error[E0506]: cannot assign to `u.b` because it is borrowed
32 --> $DIR/borrowck-union-borrow.rs:51:13
35 | ---- borrow of `u.b` occurs here
36 LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed
37 | ^^^^^^^ assignment to borrowed `u.b` occurs here
39 | -- borrow later used here
41 error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
42 --> $DIR/borrowck-union-borrow.rs:57:22
44 LL | let rma = &mut u.a;
45 | -------- mutable borrow occurs here
46 LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
47 | ^^^^ immutable borrow occurs here
49 | --- mutable borrow later used here
51 error[E0503]: cannot use `u.a` because it was mutably borrowed
52 --> $DIR/borrowck-union-borrow.rs:62:21
54 LL | let ra = &mut u.a;
55 | -------- borrow of `u.a` occurs here
56 LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed
57 | ^^^ use of borrowed `u.a`
59 | -- borrow later used here
61 error[E0499]: cannot borrow `u.a` as mutable more than once at a time
62 --> $DIR/borrowck-union-borrow.rs:67:24
64 LL | let rma = &mut u.a;
65 | -------- first mutable borrow occurs here
66 LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time
67 | ^^^^^^^^ second mutable borrow occurs here
69 | --- first borrow later used here
71 error[E0506]: cannot assign to `u.a` because it is borrowed
72 --> $DIR/borrowck-union-borrow.rs:72:13
74 LL | let rma = &mut u.a;
75 | -------- borrow of `u.a` occurs here
76 LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed
77 | ^^^^^^^ assignment to borrowed `u.a` occurs here
79 | --- borrow later used here
81 error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`)
82 --> $DIR/borrowck-union-borrow.rs:78:22
84 LL | let rma = &mut u.a;
85 | -------- mutable borrow occurs here (via `u.a`)
86 LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
87 | ^^^^ immutable borrow occurs here (via `u.b`)
89 | --- mutable borrow later used here
91 error[E0503]: cannot use `u.b` because it was mutably borrowed
92 --> $DIR/borrowck-union-borrow.rs:83:21
94 LL | let ra = &mut u.a;
95 | -------- borrow of `u.a` occurs here
96 LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed
97 | ^^^ use of borrowed `u.a`
100 | -- borrow later used here
102 error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time
103 --> $DIR/borrowck-union-borrow.rs:89:24
105 LL | let rma = &mut u.a;
106 | -------- first mutable borrow occurs here (via `u.a`)
107 LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
108 | ^^^^^^^^ second mutable borrow occurs here (via `u.b`)
110 | --- first borrow later used here
112 error[E0506]: cannot assign to `u.b` because it is borrowed
113 --> $DIR/borrowck-union-borrow.rs:94:13
115 LL | let rma = &mut u.a;
116 | -------- borrow of `u.b` occurs here
117 LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed
118 | ^^^^^^^ assignment to borrowed `u.b` occurs here
120 | --- borrow later used here
122 error: aborting due to 12 previous errors
124 Some errors occurred: E0499, E0502, E0503, E0506.
125 For more information about an error, try `rustc --explain E0499`.