]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-82462.stderr
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
[rust.git] / tests / ui / borrowck / issue-82462.stderr
1 error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
2   --> $DIR/issue-82462.rs:18:9
3    |
4 LL |     for x in DroppingSlice(&*v).iter() {
5    |              ------------------
6    |              |               |
7    |              |               immutable borrow occurs here
8    |              a temporary with access to the immutable borrow is created here ...
9 LL |         v.push(*x);
10    |         ^^^^^^^^^^ mutable borrow occurs here
11 LL |         break;
12 LL |     }
13    |     - ... and the immutable borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DroppingSlice`
14    |
15 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
16    |
17 LL |     };
18    |      +
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0502`.