1
Fork 0
rust/src/test/ui/regions/regions-close-object-into-object-4.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
767 B
Rust
Raw Normal View History

// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
2015-03-31 19:58:01 -04:00
trait A<T> { }
2019-05-28 14:46:13 -04:00
struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
2015-03-31 19:58:01 -04:00
trait X { }
impl<'a, T> X for B<'a, T> {}
2019-05-28 14:46:13 -04:00
fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
Box::new(B(&*v)) as Box<dyn X>
//[base]~^ ERROR E0759
//[nll]~^^ ERROR the parameter type `U` may not live long enough [E0310]
//[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
//[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
//[nll]~| ERROR lifetime may not live long enough
//[nll]~| ERROR cannot return value referencing local data `*v` [E0515]
//[nll]~| ERROR the parameter type `U` may not live long enough [E0310]
}
fn main() {}