rust/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
243 B
Rust
Raw Permalink Normal View History

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() {}