Module rustc::traits::specialize[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

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 guide for a bit more detail on how specialization fits together with the rest of the trait machinery.

Re-exports

use super::SelectionContext;
use super::FulfillmentContext;
use super::util::impl_trait_ref_and_oblig;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::FxHashSet;
use hir::def_id::DefId;
use infer::InferCtxt;
use infer::InferOk;
use ty::subst::Subst;
use ty::subst::Substs;
use traits;
use traits::ObligationCause;
use traits::TraitEngine;
use traits::select::IntercrateAmbiguityCause;
use ty;
use ty::TyCtxt;
use ty::TypeFoldable;
use syntax_pos::DUMMY_SP;
use rustc_data_structures::sync::Lrc;
use lint;

Modules

specialization_graph [
Experimental
]

Structs

OverlapError [
Experimental
]

Information pertinent to an overlapping impl error.

SpecializesCache [
Experimental
]

Functions

find_associated_item [
Experimental
]

Given a selected impl described by impl_data, returns the definition and substitutions for the method with the name name the kind kind, and trait method substitutions substs, in that impl, a less specialized impl, or the trait default, whichever applies.

fulfill_implication [
Experimental
]

Attempt to fulfill all obligations of target_impl after unification with source_trait_ref. If successful, returns a substitution 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.

specialization_graph_provider [
Experimental
]
specializes [
Experimental
]

Is impl1 a specialization of impl2?

to_pretty_impl_header [
Experimental
]

Recovers the "impl X for Y" signature from impl_def_id and returns it as a string.

translate_substs [
Experimental
]

Given a subst for the requested impl, translate it to a subst appropriate for the actual item definition (whether it be in that impl, a parent impl, or the trait).