summaryrefslogtreecommitdiffstats
path: root/tests/ui/lifetimes/copy_modulo_regions.rs
blob: 040fc4a0023f58669837d0d335c5c7594dc9577b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[derive(Clone)]
struct Foo<'a>(fn(&'a ()) -> &'a ());

impl Copy for Foo<'static> {}

fn mk_foo<'a>() -> Foo<'a> {
    println!("mk_foo");
    Foo(|x| x)
}

fn foo<'a>() -> [Foo<'a>; 100] {
    [mk_foo::<'a>(); 100] //~ ERROR lifetime may not live long enough
}

fn main() {
    foo();
}