]> git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/regions-close-object-into-object-4.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / regions / regions-close-object-into-object-4.rs
1 // revisions: base nll
2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
4
5 trait A<T> { }
6
7 struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
8
9 trait X { }
10 impl<'a, T> X for B<'a, T> {}
11
12 fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
13 Box::new(B(&*v)) as Box<dyn X>
14 //[base]~^ ERROR E0759
15 //[nll]~^^ ERROR the parameter type `U` may not live long enough [E0310]
16 //[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
17 //[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
18 //[nll]~| ERROR lifetime may not live long enough
19 //[nll]~| ERROR cannot return value referencing local data `*v` [E0515]
20 //[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
21
22 }
23
24 fn main() {}