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.
7 trait SomeTrait { fn get(&self) -> isize; }
9 fn make_object1<A:SomeTrait>(v: A) -> Box<SomeTrait+'static> {
10 box v as Box<SomeTrait+'static>
11 //~^ ERROR the parameter type `A` may not live long enough
12 //~| ERROR the parameter type `A` may not live long enough
15 fn make_object2<'a,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'a> {
16 box v as Box<SomeTrait+'a>
19 fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'b> {
20 box v as Box<SomeTrait+'b>
21 //~^ ERROR the parameter type `A` may not live long enough
22 //~| ERROR the parameter type `A` may not live long enough