rust/tests/ui/regions/regions-close-param-into-object.rs

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

28 lines
579 B
Rust
Raw Normal View History

2015-02-18 23:58:07 +00:00
trait X { fn foo(&self) {} }
2019-05-28 18:46:13 +00:00
fn p1<T>(v: T) -> Box<dyn X + 'static>
where T : X
{
Box::new(v) //~ ERROR parameter type `T` may not live long enough
}
2019-05-28 18:46:13 +00:00
fn p2<T>(v: Box<T>) -> Box<dyn X + 'static>
where Box<T> : X
{
Box::new(v) //~ ERROR parameter type `T` may not live long enough
}
2019-05-28 18:46:13 +00:00
fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
where T : X
{
Box::new(v) //~ ERROR parameter type `T` may not live long enough
}
2019-05-28 18:46:13 +00:00
fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
where Box<T> : X
{
Box::new(v) //~ ERROR parameter type `T` may not live long enough
}
fn main() {}