1 pub struct MyStruct<'a> { 2 field: &'a [u32], 3 } 4 5 impl MyStruct<'_> { new<'a>(field: &'a [u32]) -> MyStruct<'a>6 pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { 7 Self { field } 8 //~^ ERROR lifetime may not live long enough 9 //~| ERROR lifetime may not live long enough 10 } 11 } 12 13 trait Trait<'a> { new(field: &'a [u32]) -> MyStruct<'a>14 fn new(field: &'a [u32]) -> MyStruct<'a>; 15 } 16 17 impl<'a> Trait<'a> for MyStruct<'_> { new(field: &'a [u32]) -> MyStruct<'a>18 fn new(field: &'a [u32]) -> MyStruct<'a> { 19 Self { field } 20 //~^ ERROR lifetime may not live long enough 21 //~| ERROR lifetime may not live long enough 22 } 23 } 24 main()25fn main() {} 26