1 #![feature(type_alias_impl_trait)]
3 mod test_lifetime_param
{
4 type Ty
<'a
> = impl Sized
+ 'a
;
5 fn defining(a
: &str) -> Ty
<'_
> { a }
6 fn assert_static
<'a
: '
static>() {}
7 //~^ WARN: unnecessary lifetime parameter `'a`
8 fn test
<'a
>() where Ty
<'a
>: '
static { assert_static::<'a>() }
9 //~^ ERROR: lifetime may not live long enough
12 mod test_higher_kinded_lifetime_param
{
13 type Ty
<'a
> = impl Sized
+ 'a
;
14 fn defining(a
: &str) -> Ty
<'_
> { a }
15 fn assert_static
<'a
: '
static>() {}
16 //~^ WARN: unnecessary lifetime parameter `'a`
17 fn test
<'a
>() where for<'b
> Ty
<'b
>: 'a { assert_static::<'a>() }
18 //~^ ERROR: lifetime may not live long enough
21 mod test_higher_kinded_lifetime_param2
{
22 fn assert_static
<'a
: '
static>() {}
23 //~^ WARN: unnecessary lifetime parameter `'a`
24 fn test
<'a
>() { assert_static::<'a>() }
25 //~^ ERROR: lifetime may not live long enough
29 type Ty
<A
> = impl Sized
;
30 fn defining
<A
>(s
: A
) -> Ty
<A
> { s }
31 fn assert_static
<A
: '
static>() {}
32 fn test
<A
>() where Ty
<A
>: '
static { assert_static::<A>() }
33 //~^ ERROR: parameter type `A` may not live long enough
36 mod test_implied_from_fn_sig
{
37 type Opaque
<T
: '
static> = impl Sized
;
38 fn defining
<T
: '
static>() -> Opaque
<T
> {}
39 fn assert_static
<T
: '
static>() {}
40 fn test
<T
>(_
: Opaque
<T
>) { assert_static::<T>(); }