1 // These are all the possible variations of this error I could think of for. 2 // `trait-with-missing-associated-type-restriction-fixable.rs` contains the subset of these that 3 // can be fixed with `rustfix`. 4 5 trait Trait<T = Self> { 6 type A; 7 func(&self) -> Self::A8 fn func(&self) -> Self::A; funk(&self, _: Self::A)9 fn funk(&self, _: Self::A); funq(&self) -> Self::A10 fn funq(&self) -> Self::A {} //~ ERROR mismatched types 11 } 12 foo(_: impl Trait, x: impl Trait)13fn foo(_: impl Trait, x: impl Trait) { 14 qux(x.func()) //~ ERROR mismatched types 15 } 16 bar<T: Trait>(x: T)17fn bar<T: Trait>(x: T) { 18 qux(x.func()) //~ ERROR mismatched types 19 } 20 foo2(x: impl Trait<i32>)21fn foo2(x: impl Trait<i32>) { 22 qux(x.func()) //~ ERROR mismatched types 23 } 24 bar2<T: Trait<i32>>(x: T)25fn bar2<T: Trait<i32>>(x: T) { 26 x.funk(3); //~ ERROR mismatched types 27 qux(x.func()) //~ ERROR mismatched types 28 } 29 baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T)30fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) { 31 qux(x.func()) //~ ERROR mismatched types 32 } 33 bat(x: &mut dyn Trait<(), A = ()>)34fn bat(x: &mut dyn Trait<(), A = ()>) { 35 qux(x.func()) //~ ERROR mismatched types 36 } 37 ban<T>(x: T) where T: Trait38fn ban<T>(x: T) where T: Trait { 39 qux(x.func()) //~ ERROR mismatched types 40 } 41 qux(_: usize)42fn qux(_: usize) {} 43 main()44fn main() {} 45