Static SUPERTRAIT_ITEM_SHADOWING_USAGE

Source
pub static SUPERTRAIT_ITEM_SHADOWING_USAGE: &Lint
Expand description

The supertrait_item_shadowing_usage lint detects when the usage of an item that is provided by both a subtrait and supertrait is shadowed, preferring the subtrait.

§Example

#![feature(supertrait_item_shadowing)]
#![deny(supertrait_item_shadowing_usage)]

trait Upstream {
    fn hello(&self) {}
}
impl<T> Upstream for T {}

trait Downstream: Upstream {
    fn hello(&self) {}
}
impl<T> Downstream for T {}

struct MyType;
MyType.hello();

{{produces}}

§Explanation

RFC 3624 specified a heuristic in which a supertrait item would be shadowed by a subtrait item when ambiguity occurs during item selection. In order to mitigate side-effects of this happening silently, this lint detects these cases when users want to deny them or fix the call sites.