fork/rust
git clone https://git.julia.blue/fork/rust
5e1a799842b
1.41.0
1error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable 2 --> $DIR/borrowck-union-borrow.rs:25:23 3 | 4LL | let ra = &u.a; 5 | ---- immutable borrow occurs here 6LL | let rma = &mut u.a; 7 | ^^^^^^^^ mutable borrow occurs here 8LL | drop(ra); 9 | -- immutable borrow later used here 10 11error[E0506]: cannot assign to `u.a` because it is borrowed 12 --> $DIR/borrowck-union-borrow.rs:30:13 13 | 14LL | let ra = &u.a; 15 | ---- borrow of `u.a` occurs here 16LL | u.a = 1; 17 | ^^^^^^^ assignment to borrowed `u.a` occurs here 18LL | drop(ra); 19 | -- borrow later used here 20 21error[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 23 | 24LL | let ra = &u.a; 25 | ---- immutable borrow occurs here (via `u.a`) 26LL | let rmb = &mut u.b; 27 | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here 28LL | drop(ra); 29 | -- immutable borrow later used here 30 | 31 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` 32 33error[E0506]: cannot assign to `u.b` because it is borrowed 34 --> $DIR/borrowck-union-borrow.rs:51:13 35 | 36LL | let ra = &u.a; 37 | ---- borrow of `u.b` occurs here 38LL | u.b = 1; 39 | ^^^^^^^ assignment to borrowed `u.b` occurs here 40LL | drop(ra); 41 | -- borrow later used here 42 43error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable 44 --> $DIR/borrowck-union-borrow.rs:57:22 45 | 46LL | let rma = &mut u.a; 47 | -------- mutable borrow occurs here 48LL | let ra = &u.a; 49 | ^^^^ immutable borrow occurs here 50LL | drop(rma); 51 | --- mutable borrow later used here 52 53error[E0503]: cannot use `u.a` because it was mutably borrowed 54 --> $DIR/borrowck-union-borrow.rs:62:21 55 | 56LL | let ra = &mut u.a; 57 | -------- borrow of `u.a` occurs here 58LL | let a = u.a; 59 | ^^^ use of borrowed `u.a` 60LL | drop(ra); 61 | -- borrow later used here 62 63error[E0499]: cannot borrow `u.a` as mutable more than once at a time 64 --> $DIR/borrowck-union-borrow.rs:67:24 65 | 66LL | let rma = &mut u.a; 67 | -------- first mutable borrow occurs here 68LL | let rma2 = &mut u.a; 69 | ^^^^^^^^ second mutable borrow occurs here 70LL | drop(rma); 71 | --- first borrow later used here 72 73error[E0506]: cannot assign to `u.a` because it is borrowed 74 --> $DIR/borrowck-union-borrow.rs:72:13 75 | 76LL | let rma = &mut u.a; 77 | -------- borrow of `u.a` occurs here 78LL | u.a = 1; 79 | ^^^^^^^ assignment to borrowed `u.a` occurs here 80LL | drop(rma); 81 | --- borrow later used here 82 83error[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:78:22 85 | 86LL | let rma = &mut u.a; 87 | -------- mutable borrow occurs here (via `u.a`) 88LL | let rb = &u.b; 89 | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here 90LL | drop(rma); 91 | --- mutable borrow later used here 92 | 93 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` 94 95error[E0503]: cannot use `u.b` because it was mutably borrowed 96 --> $DIR/borrowck-union-borrow.rs:83:21 97 | 98LL | let ra = &mut u.a; 99 | -------- borrow of `u.a` occurs here 100LL | let b = u.b; 101 | ^^^ use of borrowed `u.a` 102LL | 103LL | drop(ra); 104 | -- borrow later used here 105 106error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time 107 --> $DIR/borrowck-union-borrow.rs:89:24 108 | 109LL | let rma = &mut u.a; 110 | -------- first mutable borrow occurs here (via `u.a`) 111LL | let rmb2 = &mut u.b; 112 | ^^^^^^^^ second mutable borrow occurs here (via `u.b`) 113LL | drop(rma); 114 | --- first borrow later used here 115 | 116 = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` 117 118error[E0506]: cannot assign to `u.b` because it is borrowed 119 --> $DIR/borrowck-union-borrow.rs:94:13 120 | 121LL | let rma = &mut u.a; 122 | -------- borrow of `u.b` occurs here 123LL | u.b = 1; 124 | ^^^^^^^ assignment to borrowed `u.b` occurs here 125LL | drop(rma); 126 | --- borrow later used here 127 128error: aborting due to 12 previous errors 129 130Some errors have detailed explanations: E0499, E0502, E0503, E0506. 131For more information about an error, try `rustc --explain E0499`.