Open petrochenkov opened 5 years ago
Self::V
in type namespace may refer to both variant and associated type
How is a variant present in type namespace? Syntactically only type is possible in that position, a function can't return a variant of an enum.
What is this lint about
With variants being resolved as inherent associated items (https://github.com/rust-lang/rfcs/pull/2338) code like this become ambiguous:
This is not a problem right now, because variants cannot be used in type positions, but it may become a problem in the future if https://github.com/rust-lang/rfcs/pull/2593 is accepted. So this lints warns against cases like this and recommends to rewrite them as
<Self as Tr>::V
.How to fix this warning/error
Explicitly disambiguate in favor of associated types from traits:
<Type as Trait>::Ambiguous
.Current status
ambiguous_associated_items
lint as warn-by-defaultambiguous_associated_items
lint deny-by-defaultambiguous_associated_items
lint a hard error