mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
12 lines
243 B
Rust
12 lines
243 B
Rust
type Lazy<T> = Box<dyn Fn() -> T + 'static>;
|
|
|
|
fn test(x: &i32) -> Lazy<i32> {
|
|
Box::new(|| {
|
|
//~^ ERROR lifetime may not live long enough
|
|
//~| ERROR closure may outlive the current function
|
|
*x
|
|
})
|
|
}
|
|
|
|
fn main() {}
|