1 // Test that the lifetime from the enclosing `&` is "inherited" 2 // through the `Box` struct. 3 4 #![allow(dead_code)] 5 6 trait Test { foo(&self)7 fn foo(&self) { } 8 } 9 10 struct SomeStruct<'a> { 11 t: &'a Box<dyn Test>, 12 } 13 c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>)14fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) { 15 ss.t = t; 16 //~^ ERROR lifetime may not live long enough 17 } 18 main()19fn main() { 20 } 21