Struct chalk_engine::slg::resolvent::AnswerSubstitutor
source · [−]struct AnswerSubstitutor<'t, I: Interner> {
table: &'t mut InferenceTable<I>,
environment: &'t Environment<I>,
answer_subst: &'t Substitution<I>,
outer_binder: DebruijnIndex,
ex_clause: &'t mut ExClause<I>,
interner: I,
unification_database: &'t dyn UnificationDatabase<I>,
}
Fields
table: &'t mut InferenceTable<I>
environment: &'t Environment<I>
answer_subst: &'t Substitution<I>
outer_binder: DebruijnIndex
Tracks the debrujn index of the first binder that is outside
the term we are traversing. This starts as DebruijnIndex::INNERMOST
,
since we have not yet traversed any binders, but when we visit
the inside of a binder, it would be incremented.
Example: If we are visiting (for<type> A, B, C, for<type> for<type> D)
,
then this would be:
1
, when visitingA
,0
, when visitingB
andC
,2
, when visitingD
.
ex_clause: &'t mut ExClause<I>
interner: I
unification_database: &'t dyn UnificationDatabase<I>
Implementations
sourceimpl<I: Interner> AnswerSubstitutor<'_, I>
impl<I: Interner> AnswerSubstitutor<'_, I>
fn substitute<T: Zip<I>>(
interner: I,
unification_database: &dyn UnificationDatabase<I>,
table: &mut InferenceTable<I>,
environment: &Environment<I>,
answer_subst: &Substitution<I>,
ex_clause: &mut ExClause<I>,
answer: &T,
pending: &T
) -> Fallible<()>
fn unify_free_answer_var(
&mut self,
interner: I,
db: &dyn UnificationDatabase<I>,
variance: Variance,
answer_var: BoundVar,
pending: GenericArgData<I>
) -> Fallible<bool>
sourcefn assert_matching_vars(
&mut self,
answer_var: BoundVar,
pending_var: BoundVar
) -> Fallible<()>
fn assert_matching_vars(
&mut self,
answer_var: BoundVar,
pending_var: BoundVar
) -> Fallible<()>
When we encounter a variable in the answer goal, we first try
unify_free_answer_var
. Assuming that this fails, the
variable must be a bound variable in the answer goal – in
that case, there should be a corresponding bound variable in
the pending goal. This bit of code just checks that latter
case.
Trait Implementations
sourceimpl<'i, I: Interner> Zipper<I> for AnswerSubstitutor<'i, I>
impl<'i, I: Interner> Zipper<I> for AnswerSubstitutor<'i, I>
sourcefn zip_tys(
&mut self,
variance: Variance,
answer: &Ty<I>,
pending: &Ty<I>
) -> Fallible<()>
fn zip_tys(
&mut self,
variance: Variance,
answer: &Ty<I>,
pending: &Ty<I>
) -> Fallible<()>
Indicates that the two types a
and b
were found in matching spots.
sourcefn zip_lifetimes(
&mut self,
variance: Variance,
answer: &Lifetime<I>,
pending: &Lifetime<I>
) -> Fallible<()>
fn zip_lifetimes(
&mut self,
variance: Variance,
answer: &Lifetime<I>,
pending: &Lifetime<I>
) -> Fallible<()>
Indicates that the two lifetimes a
and b
were found in matching spots.
sourcefn zip_consts(
&mut self,
variance: Variance,
answer: &Const<I>,
pending: &Const<I>
) -> Fallible<()>
fn zip_consts(
&mut self,
variance: Variance,
answer: &Const<I>,
pending: &Const<I>
) -> Fallible<()>
Indicates that the two consts a
and b
were found in matching spots.
sourcefn zip_binders<T>(
&mut self,
variance: Variance,
answer: &Binders<T>,
pending: &Binders<T>
) -> Fallible<()> where
T: HasInterner<Interner = I> + Zip<I> + TypeFoldable<I>,
fn zip_binders<T>(
&mut self,
variance: Variance,
answer: &Binders<T>,
pending: &Binders<T>
) -> Fallible<()> where
T: HasInterner<Interner = I> + Zip<I> + TypeFoldable<I>,
Zips two values appearing beneath binders.
sourcefn unification_database(&self) -> &dyn UnificationDatabase<I>
fn unification_database(&self) -> &dyn UnificationDatabase<I>
Retrieves the UnificationDatabase
from the underlying zipper object
sourcefn zip_substs(
&mut self,
ambient: Variance,
variances: Option<Variances<I>>,
a: &[GenericArg<I>],
b: &[GenericArg<I>]
) -> Result<(), NoSolution>
fn zip_substs(
&mut self,
ambient: Variance,
variances: Option<Variances<I>>,
a: &[GenericArg<I>],
b: &[GenericArg<I>]
) -> Result<(), NoSolution>
Zips two substs
Auto Trait Implementations
impl<'t, I> !RefUnwindSafe for AnswerSubstitutor<'t, I>
impl<'t, I> !Send for AnswerSubstitutor<'t, I>
impl<'t, I> !Sync for AnswerSubstitutor<'t, I>
impl<'t, I> Unpin for AnswerSubstitutor<'t, I> where
I: Unpin,
impl<'t, I> !UnwindSafe for AnswerSubstitutor<'t, I>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Cast for T
impl<T> Cast for T
sourcefn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more