]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/drop-no-may-dangle.stderr
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[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    |                                                                 ----- borrow of `v[_]` occurs here
6 ...
7 LL |         v[0] += 1;
8    |         ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
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    |                                                                 ----- borrow of `v[_]` occurs here
18 ...
19 LL |     v[0] += 1;
20    |     ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
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`.