mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
656db98bd9
CC #99430
27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
error[E0506]: cannot assign to `v[_]` because it is borrowed
|
|
--> $DIR/drop-no-may-dangle.rs:18:9
|
|
|
|
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
|
|
| ----- `v[_]` is borrowed here
|
|
...
|
|
LL | v[0] += 1;
|
|
| ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
|
|
|
|
error[E0506]: cannot assign to `v[_]` because it is borrowed
|
|
--> $DIR/drop-no-may-dangle.rs:21:5
|
|
|
|
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
|
|
| ----- `v[_]` is borrowed here
|
|
...
|
|
LL | v[0] += 1;
|
|
| ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
|
|
LL | }
|
|
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0506`.
|