mirror of
https://github.com/rust-lang/rust
synced 2024-09-06 01:11:17 +00:00
18 lines
289 B
Rust
18 lines
289 B
Rust
#[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();
|
|
}
|