rust/tests/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.

20 lines
619 B
Rust
Raw Normal View History

2015-03-31 18:58:01 -05:00
trait A<T> { }
2019-05-28 13:46:13 -05:00
struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
2015-03-31 18:58:01 -05:00
trait X { }
impl<'a, T> X for B<'a, T> {}
2019-05-28 13:46:13 -05:00
fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
Box::new(B(&*v)) as Box<dyn X>
2022-04-01 12:13:25 -05:00
//~^ ERROR the parameter type `U` may not live long enough [E0310]
//~| ERROR the parameter type `U` may not live long enough [E0310]
//~| ERROR the parameter type `U` may not live long enough [E0310]
//~| ERROR lifetime may not live long enough
//~| ERROR cannot return value referencing local data `*v` [E0515]
//~| ERROR the parameter type `U` may not live long enough [E0310]
}
fn main() {}