]> git.proxmox.com Git - rustc.git/blob - src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / type-alias-impl-trait / generic_type_does_not_live_long_enough.rs
1 // revisions: min_tait full_tait
2 #![feature(min_type_alias_impl_trait)]
3 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
4 //[full_tait]~^ WARN incomplete
5
6 fn main() {
7 let y = 42;
8 let x = wrong_generic(&y);
9 let z: i32 = x; //~ ERROR mismatched types
10 }
11
12 type WrongGeneric<T> = impl 'static;
13 //~^ ERROR the parameter type `T` may not live long enough
14 //~| ERROR: at least one trait must be specified
15
16 fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
17 t
18 }