about summary refs log tree commit diff
path: root/tests/ui/closures/closure-no-copy-mut-env.rs
blob: 890e99c1ac79c0205e1be56a28b96469892893e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
//! Checks that closures do not implement `Copy` when they capture mutable references.

fn main() {
    let mut a = 5;
    let hello = || {
        a += 1;
    };

    let b = hello;
    let c = hello; //~ ERROR use of moved value: `hello` [E0382]
}