mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +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();
|
|
}
|