1 error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-union-borrow.rs:23:23
5 | ---- immutable borrow occurs here
6 LL | let rma = &mut u.a;
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:28:13
15 | ---- borrow of `u.a` occurs here
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:44:23
25 | ---- immutable borrow occurs here (via `u.a`)
26 LL | let rmb = &mut u.b;
27 | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
29 | -- immutable borrow later used here
31 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
33 error[E0506]: cannot assign to `u.b` because it is borrowed
34 --> $DIR/borrowck-union-borrow.rs:49:13
37 | ---- borrow of `u.b` occurs here
39 | ^^^^^^^ assignment to borrowed `u.b` occurs here
41 | -- borrow later used here
43 error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
44 --> $DIR/borrowck-union-borrow.rs:55:22
46 LL | let rma = &mut u.a;
47 | -------- mutable borrow occurs here
49 | ^^^^ immutable borrow occurs here
51 | --- mutable borrow later used here
53 error[E0503]: cannot use `u.a` because it was mutably borrowed
54 --> $DIR/borrowck-union-borrow.rs:60:21
56 LL | let ra = &mut u.a;
57 | -------- borrow of `u.a` occurs here
59 | ^^^ use of borrowed `u.a`
61 | -- borrow later used here
63 error[E0499]: cannot borrow `u.a` as mutable more than once at a time
64 --> $DIR/borrowck-union-borrow.rs:65:24
66 LL | let rma = &mut u.a;
67 | -------- first mutable borrow occurs here
68 LL | let rma2 = &mut u.a;
69 | ^^^^^^^^ second mutable borrow occurs here
71 | --- first borrow later used here
73 error[E0506]: cannot assign to `u.a` because it is borrowed
74 --> $DIR/borrowck-union-borrow.rs:70:13
76 LL | let rma = &mut u.a;
77 | -------- borrow of `u.a` occurs here
79 | ^^^^^^^ assignment to borrowed `u.a` occurs here
81 | --- borrow later used here
83 error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`)
84 --> $DIR/borrowck-union-borrow.rs:76:22
86 LL | let rma = &mut u.a;
87 | -------- mutable borrow occurs here (via `u.a`)
89 | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
91 | --- mutable borrow later used here
93 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
95 error[E0503]: cannot use `u.b` because it was mutably borrowed
96 --> $DIR/borrowck-union-borrow.rs:81:21
98 LL | let ra = &mut u.a;
99 | -------- borrow of `u.a` occurs here
101 | ^^^ use of borrowed `u.a`
104 | -- borrow later used here
106 error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time
107 --> $DIR/borrowck-union-borrow.rs:87:24
109 LL | let rma = &mut u.a;
110 | -------- first mutable borrow occurs here (via `u.a`)
111 LL | let rmb2 = &mut u.b;
112 | ^^^^^^^^ second mutable borrow occurs here (via `u.b`)
114 | --- first borrow later used here
116 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
118 error[E0506]: cannot assign to `u.b` because it is borrowed
119 --> $DIR/borrowck-union-borrow.rs:92:13
121 LL | let rma = &mut u.a;
122 | -------- borrow of `u.b` occurs here
124 | ^^^^^^^ assignment to borrowed `u.b` occurs here
126 | --- borrow later used here
128 error: aborting due to 12 previous errors
130 Some errors have detailed explanations: E0499, E0502, E0503, E0506.
131 For more information about an error, try `rustc --explain E0499`.