]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
unboxed-closures and type-alias-impl-trait nll revisions
[rust.git] / src / test / ui / type-alias-impl-trait / generic_type_does_not_live_long_enough.rs
1 #![feature(type_alias_impl_trait)]
2
3 // revisions: base nll
4 // ignore-compare-mode-nll
5 //[nll] compile-flags: -Z borrowck=mir
6
7 fn main() {
8     let y = 42;
9     let x = wrong_generic(&y);
10     let z: i32 = x;
11     //~^ ERROR non-defining opaque type use
12 }
13
14 type WrongGeneric<T> = impl 'static;
15 //~^ ERROR: at least one trait must be specified
16
17 fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
18     t
19     //~^ ERROR the parameter type `T` may not live long enough
20 }