]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/functions-closures/copy-closure.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / 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 }