1 // Various tests where we over type parameters with multiple lifetime
4 trait SomeTrait { fn get(&self) -> isize; }
7 fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'a> {
8 // A outlives 'a AND 'b...
9 Box::new(v) as Box<dyn SomeTrait + 'a> // ...hence this type is safe.
12 fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'b> {
13 // A outlives 'a AND 'b...
14 Box::new(v) as Box<dyn SomeTrait + 'b> // ...hence this type is safe.
17 fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> {
18 // A outlives 'a AND 'b...but not 'c.
19 Box::new(v) as Box<dyn SomeTrait + 'a>
20 //~^ ERROR lifetime may not live long enough