Expand description
Logic and data structures related to impl specialization, explained in greater detail below.
At the moment, this implementation support only the simple βchainβ rule: If any two impls overlap, one must be a strict subset of the other.
See the rustc dev guide for a bit more detail on how specialization fits together with the rest of the trait machinery.
Re-exportsΒ§
use rustc_data_structures::fx::FxIndexSet;πuse rustc_errors::Diag;πuse rustc_hir::def_id::DefId;πuse rustc_hir::def_id::LocalDefId;πuse rustc_infer::traits::Obligation;πuse rustc_lint_defs::builtin::COHERENCE_LEAK_CHECK;πuse rustc_middle::query::LocalCrate;πuse rustc_middle::traits::query::NoSolution;πuse rustc_middle::ty::fast_reject;πuse rustc_middle::ty::fast_reject::TreatParams;πuse rustc_middle::ty::print::PrintTraitRefExt as _;πuse rustc_middle::ty;πuse rustc_middle::ty::GenericArgs;πuse rustc_middle::ty::Ty;πuse rustc_middle::ty::TyCtxt;πuse rustc_middle::ty::TypeVisitableExt;πuse rustc_middle::ty::TypingMode;πuse rustc_middle::ty::Unnormalized;πuse rustc_span::DUMMY_SP;πuse rustc_span::ErrorGuaranteed;πuse rustc_span::Span;πuse rustc_span::bug;πuse rustc_span::sym;πuse specialization_graph::GraphExt;πuse tracing::debug;πuse tracing::instrument;πuse tracing::instrument;πuse crate::diagnostics::NegativePositiveConflict;πuse crate::error_reporting::traits::to_pretty_impl_header;πuse crate::infer::InferCtxt;πuse crate::infer::TyCtxtInferExt;πuse crate::traits::select::IntercrateAmbiguityCause;πuse crate::traits::FutureCompatOverlapErrorKind;πuse crate::traits::ObligationCause;πuse crate::traits::ObligationCtxt;πuse crate::traits::coherence;πuse crate::traits::predicates_for_generics;πuse rustc_errors::codes::*;π
ModulesΒ§
StructsΒ§
- Overlap
Error - Information pertinent to an overlapping impl error.
FunctionsΒ§
- fulfill_
implication π - Attempt to fulfill all obligations of
target_implafter unification withsource_trait_ref. If successful, returns the generic parameters for all the generics oftarget_impl, including both those needed to unify withsource_trait_refand those whose identity is determined via a where clause in the impl. - report_
conflicting_ πimpls - report_
negative_ πpositive_ conflict - report_
overlap_ πconflict - specialization_
enabled_ πin - specialization_
graph_ πprovider - Query provider for
specialization_graph_of. - specializes π
- Is
specializing_impl_def_ida specialization ofparent_impl_def_id? - translate_
args - Given the generic parameters for the requested impl, translate it to the generic parameters appropriate for the actual item definition (whether it be in that impl, a parent impl, or the trait).
- translate_
args_ with_ cause - Like translate_args, but obligations from the parent implementation
are registered with the provided
ObligationCause.