Static rustc_ap_rustc_lint_defs::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS[][src]

pub static ORDER_DEPENDENT_TRAIT_OBJECTS: &Lint
Expand description

The order_dependent_trait_objects lint detects a trait coherency violation that would allow creating two trait impls for the same dynamic trait object involving marker traits.

Example

pub trait Trait {}

impl Trait for dyn Send + Sync { }
impl Trait for dyn Sync + Send { }

{{produces}}

Explanation

A previous bug caused the compiler to interpret traits with different orders (such as Send + Sync and Sync + Send) as distinct types when they were intended to be treated the same. This allowed code to define separate trait implementations when there should be a coherence error. This is a future-incompatible lint to transition this to a hard error in the future. See issue #56484 for more details.