1 // Test equality constraints in a where clause where the type being
2 // equated appears in a supertrait.
3 
4 pub trait Vehicle {
5     type Color;
6 
go(&self)7     fn go(&self) {  }
8 }
9 
10 pub trait Car : Vehicle {
honk(&self)11     fn honk(&self) { }
12 }
13 
14 struct Black;
15 struct ModelT;
16 impl Vehicle for ModelT { type Color = Black; }
17 impl Car for ModelT { }
18 
19 struct Blue;
20 struct ModelU;
21 impl Vehicle for ModelU { type Color = Blue; }
22 impl Car for ModelU { }
23 
black_car<C:Car<Color=Black>>(c: C)24 fn black_car<C:Car<Color=Black>>(c: C) {
25 }
26 
blue_car<C:Car<Color=Blue>>(c: C)27 fn blue_car<C:Car<Color=Blue>>(c: C) {
28 }
29 
a()30 fn a() { black_car(ModelT); }
b()31 fn b() { blue_car(ModelT); } //~ ERROR type mismatch
c()32 fn c() { black_car(ModelU); } //~ ERROR type mismatch
d()33 fn d() { blue_car(ModelU); }
34 
main()35 pub fn main() { }
36