#![feature(type_alias_impl_trait)]
mod test_lifetime_param {
type Ty<'a> = impl Sized + 'a;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() }
//~^ ERROR: lifetime may not live long enough
}
mod test_higher_kinded_lifetime_param {
type Ty<'a> = impl Sized + 'a;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() }
//~^ ERROR: lifetime may not live long enough
}
mod test_higher_kinded_lifetime_param2 {
fn assert_static<'a: 'static>() {}
fn test<'a>() { assert_static::<'a>() }
//~^ ERROR: lifetime may not live long enough
}
mod test_type_param {
type Ty = impl Sized;
fn defining(s: A) -> Ty { s }
fn assert_static() {}
fn test() where Ty: 'static { assert_static::() }
//~^ ERROR: parameter type `A` may not live long enough
}
mod test_implied_from_fn_sig {
type Opaque = impl Sized;
fn defining() -> Opaque {}
fn assert_static() {}
fn test(_: Opaque) { assert_static::(); }
}
fn main() {}