1 // Check that a projection `Self::V` in a trait implementation,
2 // with an associated type named `V`, for an `enum` with a variant named `V`,
3 // results in triggering the deny-by-default lint `ambiguous_associated_items`.
4 // The lint suggests that qualified syntax should be used instead.
5 // That is, the user would write `<Self as Tr>::V`.
7 // The rationale for this is that while `enum` variants do currently
8 // not exist in the type namespace but solely in the value namespace,
9 // RFC #2593 "Enum variant types", would add enum variants to the type namespace.
10 // However, currently `enum` variants are resolved with high priority as
11 // they are resolved as inherent associated items.
12 // Should #2953 therefore be implemented, `Self::V` would suddenly switch
13 // from referring to the associated type `V` instead of the variant `V`.
14 // The lint exists to keep us forward compatible with #2593.
16 // As a closing note, provided that #2933 was implemented and
17 // if `enum` variants were given lower priority than associated types,
18 // it would be impossible to refer to the `enum` variant `V` whereas
19 // the associated type could be referred to with qualified syntax as seen above.
32 fn f() -> Self::V { 0 }
33 //~^ ERROR ambiguous associated item
34 //~| ERROR ambiguous associated item
35 //~| WARN this was previously accepted
36 //~| WARN this was previously accepted
37 //~| HELP use fully-qualified syntax
38 //~| HELP use fully-qualified syntax