Module rustc_trait_selection::traits::coherence
source · Expand description
See Rustc Dev Guide chapters on trait-resolution and trait-specialization for more info on how this works.
Structs
Enums
- InCrate 🔒Whether we do the orphan check relative to this crate or to some remote crate.
Functions
- equate 🔒
- Given impl1 and impl2 check if both impls can be satisfied by a common type (including where-clauses) If so, return false, otherwise return true, they are disjoint.
- Given impl1 and impl2 check if both impls are never satisfied by a common type (including where-clauses) If so, return true, they are disjoint and false otherwise.
- Try to prove that a negative impl exist for the given obligation and its super predicates.
- Checks the coherence orphan rules.
impl_def_idshould be theDefIdof a trait impl. To pass, either the trait must be local, or else two conditions must be satisfied: - Checks whether a trait-ref is potentially implementable by a crate.
- overlap 🔒Can both impl
aand implbbe satisfied by a common type (including where-clauses)? If so, returns anImplHeaderthat unifies the two impls. - If there are types that satisfy both impls, returns
Somewith a suitably-freshenedImplHeaderwith those types substituted. Otherwise, returnsNone. - Returns whether all impls which would apply to the
trait_refe.g.Ty: Trait<Arg>are already known in the local crate.