summary refs log tree commit diff
path: root/src/test/ui/not-clone-closure.rs
blob: 134d52c495c66e9f6bb26d5c78f1a97a23c62e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Check that closures do not implement `Clone` if their environment is not `Clone`.

struct S(i32);

fn main() {
    let a = S(5);
    let hello = move || {
        println!("Hello {}", a.0);
    };

    let hello = hello.clone(); //~ ERROR the trait bound `S: std::clone::Clone` is not satisfied
}