rust/src/test/ui/not-copy-closure.nll.stderr
David Wood fcad209449
Add closure cannot be moved note.
This commit extends existing logic for checking whether a closure that
is `FnOnce` and therefore moves variables that it captures from the
environment has already been invoked when being invoked again.

Now, this logic will also check whether the closure is being moved after
previously being moved or invoked and add an appropriate note.
2018-12-26 21:55:45 +01:00

18 lines
576 B
Plaintext

error[E0382]: use of moved value: `hello`
--> $DIR/not-copy-closure.rs:10:13
|
LL | let b = hello;
| ----- value moved here
LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382]
| ^^^^^ value used here after move
|
note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
--> $DIR/not-copy-closure.rs:6:9
|
LL | a += 1;
| ^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.