]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/drop-no-may-dangle.stderr
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
[rust.git] / tests / ui / nll / drop-no-may-dangle.stderr
1 error[E0506]: cannot assign to `v[_]` because it is borrowed
2   --> $DIR/drop-no-may-dangle.rs:18:9
3    |
4 LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
5    |                                                                 ----- `v[_]` is borrowed here
6 ...
7 LL |         v[0] += 1;
8    |         ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
9 ...
10 LL | }
11    | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
12
13 error[E0506]: cannot assign to `v[_]` because it is borrowed
14   --> $DIR/drop-no-may-dangle.rs:21:5
15    |
16 LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
17    |                                                                 ----- `v[_]` is borrowed here
18 ...
19 LL |     v[0] += 1;
20    |     ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
21 LL | }
22    | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
23
24 error: aborting due to 2 previous errors
25
26 For more information about this error, try `rustc --explain E0506`.