summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
blob: c60f5c11cd18cdac45aed83d27fd8481ef67cd86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(type_alias_impl_trait)]

fn main() {
    let y = 42;
    let x = wrong_generic(&y);
    let z: i32 = x;
    //~^ ERROR expected generic type parameter, found `&i32`

    type WrongGeneric<T> = impl 'static;
    //~^ ERROR: at least one trait must be specified

    fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
        t
        //~^ ERROR the parameter type `T` may not live long enough
    }
}