rust/tests/ui/moves/issue-75904-move-closure-lo...

26 lines
858 B
Plaintext

error[E0382]: use of moved value: `a`
--> $DIR/issue-75904-move-closure-loop.rs:10:9
|
LL | let mut a = NotCopy;
| ----- move occurs because `a` has type `NotCopy`, which does not implement the `Copy` trait
LL | loop {
| ---- inside of this loop
LL | || {
| ^^ value moved into closure here, in previous iteration of loop
LL | &mut a;
LL | a;
| - use occurs due to use in closure
|
note: if `NotCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-75904-move-closure-loop.rs:5:1
|
LL | struct NotCopy;
| ^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL | a;
| - you could clone this value
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0382`.