]> git.lizzy.rs Git - rust.git/blob - tests/ui/not-clone-closure.rs
Rollup merge of #107576 - P1n3appl3:master, r=tmandry
[rust.git] / tests / ui / not-clone-closure.rs
1 // Check that closures do not implement `Clone` if their environment is not `Clone`.
2
3 struct S(i32);
4
5 fn main() {
6     let a = S(5);
7     let hello = move || {
8         println!("Hello {}", a.0);
9     };
10
11     let hello = hello.clone(); //~ ERROR the trait bound `S: Clone` is not satisfied
12 }