]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / associated-type / associated-type-projection-from-multiple-supertraits.rs
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
7     fn go(&self) {  }
8 }
9
10 pub trait Box {
11     type Color;
12     //
13     fn mail(&self) {  }
14 }
15
16 pub trait BoxCar : Box + Vehicle {
17 }
18
19 fn dent<C:BoxCar>(c: C, color: C::Color) {
20     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
21 }
22
23 fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
24     //~^ ERROR ambiguous associated type
25     //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified
26 }
27
28 fn paint<C:BoxCar>(c: C, d: C::Color) {
29     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
30 }
31
32 pub fn main() { }