[][src]Module rustc::traits

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Resolution. See the rustc guide for more information on how this works.

Re-exports

pub use self::select::EvaluationCache;
pub use self::select::EvaluationResult;
pub use self::select::OverflowError;
pub use self::select::SelectionCache;
pub use self::ObligationCauseCode::*;
pub use self::SelectionError::*;
pub use self::Vtable::*;

Modules

queryInternal

Experimental types for the trait query interface. The methods defined in this module are all based on canonicalization, which makes a canonical query by replacing unbound inference variables and regions, so that results can be reused more broadly. The providers for the queries defined here can be found in librustc_traits.

selectInternal

Candidate selection. See the rustc guide for more information on how this works.

specialization_graphInternal
structural_implsInternal

Structs

AssocTypeBoundDataInternal
DerivedObligationCauseInternal
EnvironmentInternal

A set of clauses that we assume to be true.

IfExpressionCauseInternal
InEnvironmentInternal

Something (usually a goal), along with an environment.

MatchExpressionArmCauseInternal
ObligationCauseInternal

The reason why we incurred this obligation; used for error reporting.

ProgramClauseInternal

A "program clause" has the form D :- G1, ..., Gn. It is saying that the domain goal D is true if G1...Gn are provable. This is equivalent to the implication G1..Gn => D; we usually write it with the reverse implication operator :- to emphasize the way that programs are actually solved (via backchaining, which starts with the goal to solve and proceeds from there).

VtableAutoImplDataInternal
VtableBuiltinDataInternal
VtableClosureDataInternal
VtableFnPointerDataInternal
VtableGeneratorDataInternal
VtableImplDataInternal

Identifies a particular impl in the source, along with a set of substitutions from the impl's type/lifetime parameters. The nested vector corresponds to the nested obligations attached to the impl's type parameters.

VtableObjectDataInternal

A vtable for some object-safe trait Foo automatically derived for the object type Foo.

VtableTraitAliasDataInternal

Enums

ClauseInternal

This matches the definition from Page 7 of "A Proof Procedure for the Logic of Hereditary Harrop Formulas".

DomainGoalInternal
FromEnvInternal
GoalKindInternal
ObligationCauseCodeInternal
ProgramClauseCategoryInternal
QuantifierKindInternal
RevealInternal

Depending on the stage of compilation, we want projection to be more or less conservative.

SelectionErrorInternal
VtableInternal

Given the successful resolution of an obligation, the Vtable indicates where the vtable comes from. Note that while we call this a "vtable", it does not necessarily indicate dynamic dispatch at runtime. Vtable instances just tell the compiler where to find methods, but in generic code those methods are typically statically dispatched -- only when an object is constructed is a Vtable instance reified into an actual vtable.

WellFormedInternal
WhereClauseInternal

The following types:

Traits

ChalkContextLiftInternal
ExClauseFoldInternal

Type Definitions

ChalkCanonicalGoalInternal
ClausesInternal

Multiple clauses.

GoalInternal
GoalsInternal
PolyDomainGoalInternal
SelectionResultInternal

When performing resolution, it is typically the case that there can be one of three outcomes: