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