rust/src/test/ui/not-copy-closure.rs
2018-12-25 21:08:33 -07:00

12 lines
246 B
Rust

// Check that closures do not implement `Copy` if their environment is not `Copy`.
fn main() {
let mut a = 5;
let hello = || {
a += 1;
};
let b = hello;
let c = hello; //~ ERROR use of moved value: `hello` [E0382]
}