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