2024-11-06 18:50:24 +01:00
|
|
|
//@compile-flags: --diagnostic-width=300
|
2017-09-13 22:40:48 +02:00
|
|
|
// 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);
|
|
|
|
};
|
|
|
|
|
2020-09-02 10:40:56 +03:00
|
|
|
let hello = hello.clone(); //~ ERROR the trait bound `S: Clone` is not satisfied
|
2017-09-13 22:40:48 +02:00
|
|
|
}
|