]> git.lizzy.rs Git - rust.git/blob - src/test/ui/functions-closures/copy-closure.rs
Auto merge of #100935 - cuviper:upgrade-android-ci, r=Mark-Simulacrum
[rust.git] / src / test / ui / functions-closures / copy-closure.rs
1 // run-pass
2 // Check that closures implement `Copy`.
3
4 fn call<T, F: FnOnce() -> T>(f: F) -> T { f() }
5
6 fn main() {
7     let a = 5;
8     let hello = || {
9         println!("Hello {}", a);
10         a
11     };
12
13     assert_eq!(5, call(hello.clone()));
14     assert_eq!(5, call(hello));
15     assert_eq!(5, call(hello));
16 }