[−][src]Struct chalk_ir::fold::Subst
Substitution used during folding
Implementations
impl<I: Interner, '_, '_> Subst<'_, '_, I>
[src]
pub fn apply<T: Fold<I, I>>(
interner: &I,
parameters: &[GenericArg<I>],
value: &T
) -> T::Result
[src]
interner: &I,
parameters: &[GenericArg<I>],
value: &T
) -> T::Result
Applies the substitution by folding
Trait Implementations
impl<'i, I: Interner, '_> Folder<'i, I, I> for Subst<'_, 'i, I>
[src]
fn as_dyn(&mut self) -> &mut dyn Folder<'i, I>
[src]
fn fold_free_var_ty(
&mut self,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Ty<I>>
[src]
&mut self,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Ty<I>>
We are eliminating one binder, but binders outside of that get preserved.
So e.g. consider this:
for<A, B> { for<C> { [A, C] } }
// ^ the binder we are substituing with `[u32]`
Here, A
would be ^1.0
and C
would be ^0.0
. We will replace ^0.0
with the
0th index from the list (u32
). We will convert ^1.0
(A) to ^0.0
-- i.e., shift
it out of one level of binder (the for<C>
binder we are eliminating).
This gives us as a result:
for<A, B> { [A, u32] }
^ represented as `^0.0`
fn fold_free_var_lifetime(
&mut self,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<I>>
[src]
&mut self,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<I>>
see fold_free_var_ty
fn fold_free_var_const(
&mut self,
ty: &Ty<I>,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Const<I>>
[src]
&mut self,
ty: &Ty<I>,
bound_var: BoundVar,
outer_binder: DebruijnIndex
) -> Fallible<Const<I>>
see fold_free_var_ty
fn interner(&self) -> &'i I
[src]
fn target_interner(&self) -> &'i I
[src]
fn fold_ty(
&mut self,
ty: &Ty<I>,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
[src]
&mut self,
ty: &Ty<I>,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
fn fold_lifetime(
&mut self,
lifetime: &Lifetime<I>,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
[src]
&mut self,
lifetime: &Lifetime<I>,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
fn fold_const(
&mut self,
constant: &Const<I>,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
[src]
&mut self,
constant: &Const<I>,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
fn fold_program_clause(
&mut self,
clause: &ProgramClause<I>,
outer_binder: DebruijnIndex
) -> Fallible<ProgramClause<TI>>
[src]
&mut self,
clause: &ProgramClause<I>,
outer_binder: DebruijnIndex
) -> Fallible<ProgramClause<TI>>
fn fold_goal(
&mut self,
goal: &Goal<I>,
outer_binder: DebruijnIndex
) -> Fallible<Goal<TI>>
[src]
&mut self,
goal: &Goal<I>,
outer_binder: DebruijnIndex
) -> Fallible<Goal<TI>>
fn forbid_free_vars(&self) -> bool
[src]
fn forbid_free_placeholders(&self) -> bool
[src]
fn fold_free_placeholder_ty(
&mut self,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
[src]
&mut self,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
fn fold_free_placeholder_lifetime(
&mut self,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
[src]
&mut self,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
fn fold_free_placeholder_const(
&mut self,
ty: &Ty<I>,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
[src]
&mut self,
ty: &Ty<I>,
universe: PlaceholderIndex,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
fn forbid_inference_vars(&self) -> bool
[src]
fn fold_inference_ty(
&mut self,
var: InferenceVar,
kind: TyKind,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
[src]
&mut self,
var: InferenceVar,
kind: TyKind,
outer_binder: DebruijnIndex
) -> Fallible<Ty<TI>>
fn fold_inference_lifetime(
&mut self,
var: InferenceVar,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
[src]
&mut self,
var: InferenceVar,
outer_binder: DebruijnIndex
) -> Fallible<Lifetime<TI>>
fn fold_inference_const(
&mut self,
ty: &Ty<I>,
var: InferenceVar,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
[src]
&mut self,
ty: &Ty<I>,
var: InferenceVar,
outer_binder: DebruijnIndex
) -> Fallible<Const<TI>>
Auto Trait Implementations
impl<'s, 'i, I> RefUnwindSafe for Subst<'s, 'i, I> where
I: RefUnwindSafe,
<I as Interner>::InternedGenericArg: RefUnwindSafe,
I: RefUnwindSafe,
<I as Interner>::InternedGenericArg: RefUnwindSafe,
impl<'s, 'i, I> Send for Subst<'s, 'i, I> where
I: Sync,
<I as Interner>::InternedGenericArg: Sync,
I: Sync,
<I as Interner>::InternedGenericArg: Sync,
impl<'s, 'i, I> Sync for Subst<'s, 'i, I> where
I: Sync,
<I as Interner>::InternedGenericArg: Sync,
I: Sync,
<I as Interner>::InternedGenericArg: Sync,
impl<'s, 'i, I> Unpin for Subst<'s, 'i, I>
impl<'s, 'i, I> UnwindSafe for Subst<'s, 'i, I> where
I: RefUnwindSafe,
<I as Interner>::InternedGenericArg: RefUnwindSafe,
I: RefUnwindSafe,
<I as Interner>::InternedGenericArg: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Cast for T
[src]
fn cast<U>(self, interner: &U::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
[src]
Self: CastTo<U>,
U: HasInterner,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,