]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-static-closure.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-static-closure.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3
4 struct closure_box<'a> {
5     cl: Box<dyn FnMut() + 'a>,
6 }
7
8 fn box_it<'a>(x: Box<dyn FnMut() + 'a>) -> closure_box<'a> {
9     closure_box {cl: x}
10 }
11
12 fn call_static_closure(mut cl: closure_box<'static>) {
13     (cl.cl)();
14 }
15
16 pub fn main() {
17     let cl_box = box_it(Box::new(|| println!("Hello, world!")));
18     call_static_closure(cl_box);
19 }