mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +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();
|
|
}
|