2018-12-24 13:22:25 -06:00
|
|
|
error[E0502]: cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`)
|
2021-04-03 06:05:11 -05:00
|
|
|
--> $DIR/issue-45157.rs:27:20
|
2018-01-24 07:14:58 -06:00
|
|
|
|
|
2018-02-24 17:59:34 -06:00
|
|
|
LL | let mref = &mut u.s.a;
|
2018-12-24 13:22:25 -06:00
|
|
|
| ---------- mutable borrow occurs here (via `u.s.a`)
|
2018-01-24 07:14:58 -06:00
|
|
|
...
|
2018-02-24 17:59:34 -06:00
|
|
|
LL | let nref = &u.z.c;
|
2019-01-04 15:43:51 -06:00
|
|
|
| ^^^^^^ immutable borrow of `u.z.c` -- which overlaps with `u.s.a` -- occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL |
|
2018-03-05 16:29:05 -06:00
|
|
|
LL | println!("{} {}", mref, nref)
|
2018-09-29 05:47:47 -05:00
|
|
|
| ---- mutable borrow later used here
|
2019-01-04 15:43:51 -06:00
|
|
|
|
|
|
|
|
= note: `u.z.c` is a field of the union `U`, so it overlaps the field `u.s.a`
|
2018-01-24 07:14:58 -06:00
|
|
|
|
2018-03-06 02:37:21 -06:00
|
|
|
error: aborting due to previous error
|
2018-01-24 07:14:58 -06:00
|
|
|
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about this error, try `rustc --explain E0502`.
|