pub static COINDUCTIVE_OVERLAP_IN_COHERENCE: &Lint
Expand description

The coinductive_overlap_in_coherence lint detects impls which are currently considered not overlapping, but may be considered to overlap if support for coinduction is added to the trait solver.

Example

#![deny(coinductive_overlap_in_coherence)]

trait CyclicTrait {}
impl<T: CyclicTrait> CyclicTrait for T {}

trait Trait {}
impl<T: CyclicTrait> Trait for T {}
// conflicting impl with the above
impl Trait for u8 {}

{{produces}}

Explanation

We have two choices for impl which satisfy u8: Trait: the blanket impl for generic T, and the direct impl for u8. These two impls nominally overlap, since we can infer T = u8 in the former impl, but since the where clause u8: CyclicTrait would end up resulting in a cycle (since it depends on itself), the blanket impl is not considered to hold for u8. This will change in a future release.