1 // Test a "pass-through" object-lifetime-default that produces errors.
9 struct MyBox<T:?Sized> {
13 fn deref<T>(ss: &T) -> T {
14 // produces the type of a deref without worrying about whether a
15 // move out would actually be legal
19 fn load0(ss: &MyBox<dyn SomeTrait>) -> MyBox<dyn SomeTrait> {
23 fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>,
24 b: &'b MyBox<dyn SomeTrait>)
25 -> &'b MyBox<dyn SomeTrait>
28 //~^ ERROR lifetime may not live long enough
31 fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> {
33 //~^ ERROR borrowed data escapes outside of function