c2b477c19a
This commit improves diagnostic labels to mention which field a borrow overlaps with and adds a note explaining that the fields overlap.
27 lines
995 B
Plaintext
27 lines
995 B
Plaintext
error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time
|
|
--> $DIR/issue-17263.rs:17:34
|
|
|
|
|
LL | let (a, b) = (&mut x.a, &mut x.b);
|
|
| --- ^^^ second mutable borrow occurs here (via `x.b`)
|
|
| |
|
|
| first mutable borrow occurs here (via `x.a`)
|
|
...
|
|
LL | }
|
|
| - first borrow ends here
|
|
|
|
error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`)
|
|
--> $DIR/issue-17263.rs:21:32
|
|
|
|
|
LL | let (c, d) = (&mut foo.a, &foo.b);
|
|
| ----- ^^^^^ immutable borrow of `foo.b` -- which overlaps with `foo.a` -- occurs here
|
|
| |
|
|
| mutable borrow occurs here (via `foo.a`)
|
|
...
|
|
LL | }
|
|
| - mutable borrow ends here
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
Some errors occurred: E0499, E0502.
|
|
For more information about an error, try `rustc --explain E0499`.
|