rust/tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
1.0 KiB
Plaintext
Raw Normal View History

error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
--> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
|
LL | let z = copy_borrowed_ptr(&mut y);
2023-01-15 03:06:44 +00:00
| ------ `y` is borrowed here
LL | *y.pointer += 1;
| ^^^^^^^^^^^^^^^ use of borrowed `y`
...
LL | *z.pointer += 1;
| --------------- borrow later used here
2018-08-08 12:28:26 +00:00
error[E0506]: cannot assign to `*y.pointer` because it is borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
2018-08-08 12:28:26 +00:00
|
LL | let z = copy_borrowed_ptr(&mut y);
2023-01-15 03:06:44 +00:00
| ------ `*y.pointer` is borrowed here
2019-03-09 12:03:44 +00:00
LL | *y.pointer += 1;
2023-01-15 03:06:44 +00:00
| ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed
...
LL | *z.pointer += 1;
| --------------- borrow later used here
2018-08-08 12:28:26 +00:00
error: aborting due to 2 previous errors
2018-08-08 12:28:26 +00:00
Some errors have detailed explanations: E0503, E0506.
For more information about an error, try `rustc --explain E0503`.