blob: 4b97f812815c0274e2a6ad0935821119b7269998 [file] [edit]
error[E0382]: borrow of moved value: `x`
--> $DIR/use-after-move.rs:6:14
|
LL | let x = vec![1, 2, 3];
| - move occurs because `x` has type `Vec<i32>`, which does not implement the `Copy` trait
LL | let _c = || {
| ^^ value borrowed here after move
LL |
LL | let y = move(x);
| - value moved here
LL | println!("{x:?}");
| - borrow occurs due to use in closure
|
help: consider cloning the value if the performance cost is acceptable
|
LL | let y = move(x.clone());
| ++++++++
help: borrow this binding in the pattern to avoid moving the value
|
LL | let y = move(ref x);
| +++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0382`.