]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.rs
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-types / associated-type-projection-ambig-between-bound-and-where-clause.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 fn a<C:Vehicle+Box>(_: C::Color) {
17     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
18 }
19
20 fn b<C>(_: C::Color) where C : Vehicle+Box {
21     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
22 }
23
24 fn c<C>(_: C::Color) where C : Vehicle, C : Box {
25     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
26 }
27
28 struct D<X>;
29 impl<X> D<X> where X : Vehicle {
30     fn d(&self, _: X::Color) where X : Box { }
31     //~^ ERROR ambiguous associated type `Color` in bounds of `X`
32 }
33
34 trait E<X:Vehicle> {
35     fn e(&self, _: X::Color) where X : Box;
36     //~^ ERROR ambiguous associated type `Color` in bounds of `X`
37
38     fn f(&self, _: X::Color) where X : Box { }
39     //~^ ERROR ambiguous associated type `Color` in bounds of `X`
40 }
41
42 pub fn main() { }