fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.1 KiB26 linesraw
1error[E0506]: cannot assign to `v[_]` because it is borrowed
2  --> $DIR/drop-no-may-dangle.rs:20:9
3   |
4LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
5   |                                                                 ----- borrow of `v[_]` occurs here
6...
7LL |         v[0] += 1;
8   |         ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
9...
10LL | }
11   | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
12
13error[E0506]: cannot assign to `v[_]` because it is borrowed
14  --> $DIR/drop-no-may-dangle.rs:23:5
15   |
16LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
17   |                                                                 ----- borrow of `v[_]` occurs here
18...
19LL |     v[0] += 1;
20   |     ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
21LL | }
22   | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
23
24error: aborting due to 2 previous errors
25
26For more information about this error, try `rustc --explain E0506`.