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
- Compute the
intercrate_ambiguity_causes
for the new solver using “proof trees”. - Check if both impls can be satisfied by a common type by considering whether any of either impl’s obligations is not known to hold.
- Check if both impls can be satisfied by a common type by considering whether any of first impl’s obligations is known not to hold via a negative predicate.
- Try to prove that a negative impl exist for the obligation or its supertraits.
- Checks the coherence orphan rules.
impl_def_id
should be theDefId
of 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
a
and implb
be satisfied by a common type (including where-clauses)? If so, returns anImplHeader
that unifies the two impls. - If there are types that satisfy both impls, returns
Some
with a suitably-freshenedImplHeader
with those types substituted. Otherwise, returnsNone
. - Returns whether all impls which would apply to the
trait_ref
e.g.Ty: Trait<Arg>
are already known in the local crate.