1 #![feature(box_syntax)]
3 // Test for what happens when a type parameter `A` is closed over into
4 // an object. This should yield errors unless `A` (and the object)
5 // both have suitable bounds.
8 fn get(&self) -> isize;
11 fn make_object1<A: SomeTrait>(v: A) -> Box<dyn SomeTrait + 'static> {
12 box v as Box<dyn SomeTrait + 'static>
13 //~^ ERROR the parameter type `A` may not live long enough
16 fn make_object2<'a, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'a> {
17 box v as Box<dyn SomeTrait + 'a>
20 fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'b> {
21 box v as Box<dyn SomeTrait + 'b>
22 //~^ ERROR the parameter type `A` may not live long enough