]> git.lizzy.rs Git - rust.git/blob - src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs
02bb151ccb618dfa810171cf6c5e6fb3e4227fbc
[rust.git] / src / test / ui / existential_types / generic_type_does_not_live_long_enough.rs
1 #![feature(existential_type)]
2
3 fn main() {
4     let y = 42;
5     let x = wrong_generic(&y);
6     let z: i32 = x; //~ ERROR mismatched types
7 }
8
9 existential type WrongGeneric<T>: 'static;
10 //~^ ERROR the parameter type `T` may not live long enough
11
12 fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
13     t
14 }