]> git.lizzy.rs Git - rust.git/blob - tests/ui/trait-bounds/impl-derived-implicit-sized-bound-2.rs
Rollup merge of #106813 - oli-obk:sess_cleanup, r=GuillaumeGomez,petrochenkov
[rust.git] / tests / ui / trait-bounds / impl-derived-implicit-sized-bound-2.rs
1 struct Victim<'a, T: Perpetrator + ?Sized> {
2   value: u8,
3   perp: &'a T,
4 }
5
6 trait VictimTrait {
7   type Ret;
8   fn get(self) -> Self::Ret;
9 }
10
11 // Actual fix is here
12 impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
13   type Ret = u8;
14   fn get(self) -> Self::Ret {
15     self.value
16   }
17 }
18
19 trait Perpetrator {
20   fn getter<'a>(&'a self) -> Victim<'a, Self> {
21     Victim {
22       value: 0,
23       perp: self,
24     }
25   }
26
27   fn trigger(&self) {
28     self.getter().get();
29     //~^ ERROR the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied
30   }
31 }
32
33 fn main() {}