]> git.lizzy.rs Git - rust.git/blob - src/test/ui/not-clone-closure.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / 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: std::clone::Clone` is not satisfied
12 }