]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorino
[rust.git] / tests / ui / type-alias-impl-trait / generic_type_does_not_live_long_enough.rs
1 #![feature(type_alias_impl_trait)]
2
3 fn main() {
4     let y = 42;
5     let x = wrong_generic(&y);
6     let z: i32 = x;
7     //~^ ERROR expected generic type parameter, found `&'static i32
8 }
9
10 type WrongGeneric<T> = impl 'static;
11 //~^ ERROR: at least one trait must be specified
12
13 fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
14     t
15     //~^ ERROR the parameter type `T` may not live long enough
16 }