]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr
Auto merge of #102283 - GuillaumeGomez:option-code-example-unwrap-or-default, r=thomcc
[rust.git] / src / test / ui / borrowck / reborrow-sugg-move-then-borrow.stderr
1 error[E0382]: borrow of moved value: `state`
2   --> $DIR/reborrow-sugg-move-then-borrow.rs:20:18
3    |
4 LL | fn fill_memory_blocks_mt(state: &mut State) {
5    |                          ----- move occurs because `state` has type `&mut State`, which does not implement the `Copy` trait
6 LL |     for _ in state {}
7    |              ----- `state` moved due to this implicit call to `.into_iter()`
8 LL |
9 LL |     fill_segment(state);
10    |                  ^^^^^ value borrowed here after move
11    |
12 note: this function takes ownership of the receiver `self`, which moves `state`
13   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
14    |
15 LL |     fn into_iter(self) -> Self::IntoIter;
16    |                  ^^^^
17 help: consider creating a fresh reborrow of `state` here
18    |
19 LL |     for _ in &mut *state {}
20    |              ++++++
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0382`.