rust/tests/ui/not-copy-closure.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
246 B
Rust
Raw Normal View History

2017-09-13 15:40:48 -05:00
// 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]
}