[−][src]Type Definition rustc_middle::ty::subst::InternalSubsts
type InternalSubsts<'tcx> = List<GenericArg<'tcx>>;
A substitution mapping generic parameters to new values.
Implementations
impl<'a, 'tcx> InternalSubsts<'tcx>[src]
pub fn as_closure(&'a self) -> ClosureSubsts<'a>[src]
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.
pub fn as_generator(&'tcx self) -> GeneratorSubsts<'tcx>[src]
Interpret these substitutions as the substitutions of a generator type.
Closure 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.
pub fn identity_for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> SubstsRef<'tcx>[src]
Creates a InternalSubsts that maps each generic parameter to itself.
pub fn for_item<F>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
mk_kind: F
) -> SubstsRef<'tcx> where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>, [src]
tcx: TyCtxt<'tcx>,
def_id: DefId,
mk_kind: F
) -> SubstsRef<'tcx> where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>,
Creates a 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.
pub fn extend_to<F>(
&self,
tcx: TyCtxt<'tcx>,
def_id: DefId,
mk_kind: F
) -> SubstsRef<'tcx> where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>, [src]
&self,
tcx: TyCtxt<'tcx>,
def_id: DefId,
mk_kind: F
) -> SubstsRef<'tcx> where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>,
pub(in ty::subst) fn fill_item<F>(
substs: &mut SmallVec<[GenericArg<'tcx>; 8]>,
tcx: TyCtxt<'tcx>,
defs: &Generics,
mk_kind: &mut F
) where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>, [src]
substs: &mut SmallVec<[GenericArg<'tcx>; 8]>,
tcx: TyCtxt<'tcx>,
defs: &Generics,
mk_kind: &mut F
) where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>,
pub(in ty::subst) fn fill_single<F>(
substs: &mut SmallVec<[GenericArg<'tcx>; 8]>,
defs: &Generics,
mk_kind: &mut F
) where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>, [src]
substs: &mut SmallVec<[GenericArg<'tcx>; 8]>,
defs: &Generics,
mk_kind: &mut F
) where
F: FnMut(&GenericParamDef, &[GenericArg<'tcx>]) -> GenericArg<'tcx>,
pub fn is_noop(&self) -> bool[src]
pub fn types(&'a self) -> impl DoubleEndedIterator<Item = Ty<'tcx>> + 'a[src]
pub fn regions(&'a self) -> impl DoubleEndedIterator<Item = Region<'tcx>> + 'a[src]
pub fn consts(
&'a self
) -> impl DoubleEndedIterator<Item = &'tcx Const<'tcx>> + 'a[src]
&'a self
) -> impl DoubleEndedIterator<Item = &'tcx Const<'tcx>> + 'a
pub fn non_erasable_generics(
&'a self
) -> impl DoubleEndedIterator<Item = GenericArgKind<'tcx>> + 'a[src]
&'a self
) -> impl DoubleEndedIterator<Item = GenericArgKind<'tcx>> + 'a
pub fn type_at(&self, i: usize) -> Ty<'tcx>[src]
pub fn region_at(&self, i: usize) -> Region<'tcx>[src]
pub fn const_at(&self, i: usize) -> &'tcx Const<'tcx>[src]
pub fn type_for_def(&self, def: &GenericParamDef) -> GenericArg<'tcx>[src]
pub fn rebase_onto(
&self,
tcx: TyCtxt<'tcx>,
source_ancestor: DefId,
target_substs: SubstsRef<'tcx>
) -> SubstsRef<'tcx>[src]
&self,
tcx: TyCtxt<'tcx>,
source_ancestor: DefId,
target_substs: SubstsRef<'tcx>
) -> SubstsRef<'tcx>
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
selfis[Self, S, T]: the identity substs offin the trait. - If
source_ancestoris the def_id of the trait. - If
target_substsis[U], the substs for the impl. - Then we will return
[U, T], the subst forfin the impl that are needed for it to match the trait.
pub fn truncate_to(
&self,
tcx: TyCtxt<'tcx>,
generics: &Generics
) -> SubstsRef<'tcx>[src]
&self,
tcx: TyCtxt<'tcx>,
generics: &Generics
) -> SubstsRef<'tcx>