Skip to main content

Module coherence

Module coherence 

Source
Expand description

See Rustc Dev Guide chapters on trait-resolution and trait-specialization for more info on how this works.

Re-exportsΒ§

use std::fmt::Debug; πŸ”’
use std::fmt::Debug; πŸ”’
use rustc_data_structures::fx::FxHashSet; πŸ”’
use rustc_data_structures::fx::FxIndexSet; πŸ”’
use rustc_errors::Diag; πŸ”’
use rustc_hir::def_id::CRATE_DEF_ID; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_infer::infer::DefineOpaqueTypes; πŸ”’
use rustc_infer::infer::InferCtxt; πŸ”’
use rustc_infer::infer::TyCtxtInferExt; πŸ”’
use rustc_infer::traits::PredicateObligations; πŸ”’
use rustc_infer::traits::TraitErrors; πŸ”’
use rustc_macros::TypeFoldable; πŸ”’
use rustc_macros::TypeVisitable; πŸ”’
use rustc_middle::traits::query::NoSolution; πŸ”’
use rustc_middle::traits::solve::CandidateSource; πŸ”’
use rustc_middle::traits::solve::Certainty; πŸ”’
use rustc_middle::traits::solve::Goal; πŸ”’
use rustc_middle::traits::specialization_graph::OverlapMode; πŸ”’
use rustc_middle::ty::fast_reject::DeepRejectCtxt; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_middle::ty::TypeSuperVisitable; πŸ”’
use rustc_middle::ty::TypeVisitable; πŸ”’
use rustc_middle::ty::TypeVisitableExt; πŸ”’
use rustc_middle::ty::TypeVisitor; πŸ”’
use rustc_middle::ty::TypingMode; πŸ”’
use rustc_middle::ty::Unnormalized; πŸ”’
use rustc_next_trait_solver::solve::SolverDelegateEvalExt; πŸ”’
use rustc_span::DUMMY_SP; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::bug; πŸ”’
use tracing::debug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use tracing::warn; πŸ”’
use super::ObligationCtxt; πŸ”’
use crate::error_reporting::traits::suggest_new_overflow_limit; πŸ”’
use crate::infer::InferOk; πŸ”’
use crate::solve::inspect::InferCtxtProofTreeExt; πŸ”’
use crate::solve::inspect::InspectGoal; πŸ”’
use crate::solve::inspect::ProofTreeVisitor; πŸ”’
use crate::solve::SolverDelegate; πŸ”’
use crate::solve::deeply_normalize_for_diagnostics; πŸ”’
use crate::solve::inspect; πŸ”’
use crate::traits::query::evaluate_obligation::InferCtxtExt; πŸ”’
use crate::traits::select::IntercrateAmbiguityCause; πŸ”’
use crate::traits::FulfillmentErrorCode; πŸ”’
use crate::traits::Obligation; πŸ”’
use crate::traits::ObligationCause; πŸ”’
use crate::traits::PredicateObligation; πŸ”’
use crate::traits::SkipLeakCheck; πŸ”’
use crate::traits::util; πŸ”’

StructsΒ§

AmbiguityCausesVisitor πŸ”’
ImplHeader
The β€œheader” of an impl is everything outside the body: a Self type, a trait ref (in the case of a trait impl), and a set of predicates (from the bounds / where-clauses).
OverlapResult
UncoveredTyParams

EnumsΒ§

Conflict
InCrate
Whether we do the orphan check relative to this crate or to some remote crate.
IntersectionHasImpossibleObligations πŸ”’
The result of [fn impl_intersection_has_impossible_obligation].
IsFirstInputType
OrphanCheckErr
OrphanCheckMode

FunctionsΒ§

add_placeholder_note
compute_intercrate_ambiguity_causes πŸ”’
Compute the intercrate_ambiguity_causes for the new solver using β€œproof trees”.
equate_impl_headers πŸ”’
fresh_impl_header πŸ”’
impl_intersection_has_impossible_obligation πŸ”’
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.
impl_intersection_has_negative_obligation πŸ”’
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.
orphan_check_trait_ref
Checks whether a trait-ref is potentially implementable by a crate.
overlap πŸ”’
Can both impl a and impl b be satisfied by a common type (including where-clauses)? If so, returns an ImplHeader that unifies the two impls.
overlapping_impls πŸ”’
overlapping_inherent_impls
If there are types that satisfy both impls, returns Some with a suitably-freshened ImplHeader with those types instantiated. Otherwise, returns None.
overlapping_trait_impls
If there are types that satisfy both impls, returns Some with a suitably-freshened ImplHeader with those types instantiated. Otherwise, returns None.
plug_infer_with_placeholders πŸ”’
search_ambiguity_causes πŸ”’
suggest_increasing_recursion_limit πŸ”’
trait_ref_is_knowable
Returns whether all impls which would apply to the trait_ref e.g. Ty: Trait<Arg> are already known in the local crate.
trait_ref_is_local_or_fundamental
try_prove_negated_where_clause πŸ”’