]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-close-object-into-object-5.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-close-object-into-object-5.rs
1 #![allow(warnings)]
2
3
4 trait A<T>
5 {
6     fn get(&self) -> T { panic!() }
7 }
8
9 struct B<'a, T: 'a>(&'a (A<T> + 'a));
10
11 trait X { fn foo(&self) {} }
12
13 impl<'a, T> X for B<'a, T> {}
14
15 fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
16     // oh dear!
17     Box::new(B(&*v)) as Box<dyn X>
18     //~^ ERROR the parameter type `T` may not live long enough
19     //~| ERROR the parameter type `T` may not live long enough
20     //~| ERROR the parameter type `T` may not live long enough
21     //~| ERROR the parameter type `T` may not live long enough
22     //~| ERROR cannot return value referencing local data `*v` [E0515]
23 }
24
25 fn main() {}