Skip to main content

Module specialize

Module specialize 

Source
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Β§

specialization_graph

StructsΒ§

OverlapError
Information pertinent to an overlapping impl error.

FunctionsΒ§

fulfill_implication πŸ”’
Attempt to fulfill all obligations of target_impl after unification with source_trait_ref. If successful, returns the generic parameters for all the generics of target_impl, including both those needed to unify with source_trait_ref and 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_id a specialization of parent_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.