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; //~ ERROR mismatched types 16 } 17 main()18fn main() { 19 } 20