1 // FIXME: the following cases need to suggest more things to make users reach a working end state.
4 trait OtherTrait<'a> {}
5 impl<'a> OtherTrait<'a> for &'a () {}
11 fn use_self(&self) -> &() { panic!() }
15 impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
16 fn use_self(&self) -> &() { panic!() }
20 fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
21 val.use_self() //~ ERROR cannot return reference to function parameter
26 trait OtherTrait<'a> {}
27 impl<'a> OtherTrait<'a> for &'a () {}
33 fn use_self(&self) -> &() { panic!() }
37 impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
38 fn use_self(&self) -> &() { panic!() }
42 fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> + 'a {
43 val.use_self() //~ ERROR E0515
47 // This case in particular requires the user to write all of the bounds we have in `mod bax`.
49 trait OtherTrait<'a> {}
50 impl<'a> OtherTrait<'a> for &'a () {}
56 fn use_self(&self) -> &() { panic!() }
60 impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
61 fn use_self(&self) -> &() { panic!() }
65 fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
71 trait OtherTrait<'a> {}
72 impl<'a> OtherTrait<'a> for &'a () {}
78 fn use_self(&'a self) -> &'a () { panic!() }
82 impl<'a> MyTrait<'a> for Box<dyn ObjectTrait<Assoc = i32> + 'a> {
83 fn use_self(&'a self) -> &'a () { panic!() }
87 fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
93 trait OtherTrait<'a> {}
94 impl<'a> OtherTrait<'a> for &'a () {}
100 fn use_self(&self) -> &() { panic!() }
104 impl<'a> MyTrait for Box<dyn ObjectTrait<Assoc = Box<dyn Bar>>> {
105 fn use_self(&self) -> &() { panic!() }
108 fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = Box<dyn Bar>>>) -> impl OtherTrait<'a> + 'a{
109 val.use_self() //~ ERROR E0515