Type Definition rustc_middle::ty::subst::InternalSubsts

source ·
pub type InternalSubsts<'tcx> = List<GenericArg<'tcx>>;
Expand description

List of generic arguments that are gonna be used to substitute generic parameters.

Implementations§

Checks whether all elements of this list are types, if so, transmute.

Interpret these substitutions as the substitutions of a closure type. Closure substitutions have a particular structure controlled by the compiler that encodes information like the signature and closure kind; see ty::ClosureSubsts struct for more comments.

Interpret these substitutions as the substitutions of a generator type. Generator substitutions have a particular structure controlled by the compiler that encodes information like the signature and generator kind; see ty::GeneratorSubsts struct for more comments.

Interpret these substitutions as the substitutions of an inline const. Inline const substitutions have a particular structure controlled by the compiler that encodes information like the inferred type; see ty::InlineConstSubsts struct for more comments.

Creates an InternalSubsts that maps each generic parameter to itself.

Creates an InternalSubsts for generic parameter definitions, by calling closures to obtain each kind. The closures get to observe the InternalSubsts as they’re being built, which can be used to correctly substitute defaults of generic parameters.

Transform from substitutions for a child of source_ancestor (e.g., a trait or impl) to substitutions for the same child in a different item, with target_substs as the base for the target impl/trait, with the source child-specific parameters (e.g., method parameters) on top of that base.

For example given:

trait X<S> { fn f<T>(); }
impl<U> X<U> for U { fn f<V>() {} }
  • If self is [Self, S, T]: the identity substs of f in the trait.
  • If source_ancestor is the def_id of the trait.
  • If target_substs is [U], the substs for the impl.
  • Then we will return [U, T], the subst for f in the impl that are needed for it to match the trait.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: (unsized)