]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/moves-based-on-type-access-to-field.stderr
fn-trait-closure test now pass on new solver
[rust.git] / tests / ui / moves / moves-based-on-type-access-to-field.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/moves-based-on-type-access-to-field.rs:11:12
3    |
4 LL |     let x = vec!["hi".to_string()];
5    |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
6 LL |     consume(x.into_iter().next().unwrap());
7    |               ----------- `x` moved due to this method call
8 LL |     touch(&x[0]);
9    |            ^ value borrowed here after move
10    |
11 note: `into_iter` takes ownership of the receiver `self`, which moves `x`
12   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
13 help: you can `clone` the value and consume it, but this might not be your desired behavior
14    |
15 LL |     consume(x.clone().into_iter().next().unwrap());
16    |               ++++++++
17
18 error: aborting due to previous error
19
20 For more information about this error, try `rustc --explain E0382`.