]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-close-param-into-object.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-close-param-into-object.rs
1 trait X { fn foo(&self) {} }
2
3 fn p1<T>(v: T) -> Box<dyn X + 'static>
4     where T : X
5 {
6     Box::new(v) //~ ERROR parameter type `T` may not live long enough
7 }
8
9 fn p2<T>(v: Box<T>) -> Box<dyn X + 'static>
10     where Box<T> : X
11 {
12     Box::new(v) //~ ERROR parameter type `T` may not live long enough
13 }
14
15 fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
16     where T : X
17 {
18     Box::new(v) //~ ERROR parameter type `T` may not live long enough
19 }
20
21 fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
22     where Box<T> : X
23 {
24     Box::new(v) //~ ERROR parameter type `T` may not live long enough
25 }
26
27 fn main() {}