mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
12 lines
323 B
Rust
12 lines
323 B
Rust
struct NoCopy;
|
|
fn main() {
|
|
let x = NoCopy;
|
|
//~^ NOTE move occurs because `x` has type `NoCopy`
|
|
let f = move || { let y = x; };
|
|
//~^ NOTE value moved into closure here
|
|
//~| NOTE variable moved due to use in closure
|
|
let z = x;
|
|
//~^ ERROR use of moved value: `x`
|
|
//~| NOTE value used here after move
|
|
}
|