0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-21 22:01:17 +01:00
rust/tests/ui/not-clone-closure.rs
Hans Wennborg 029add206f Add --diagnostic-width to some tests failing after 1a0c502183
Otherwise the tests would fail depending on the execution environment.
2024-11-06 20:02:42 +01:00

14 lines
329 B
Rust

//@compile-flags: --diagnostic-width=300
// 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: Clone` is not satisfied
}