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 visiting A,
  • 0, when visiting B and C,
  • 2, when visiting D.
§ex_clause: &'t mut ExClause<I>§interner: I§unification_database: &'t dyn UnificationDatabase<I>

Implementations§

source§

impl<I: Interner> AnswerSubstitutor<'_, I>

source

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<()>

source

fn unify_free_answer_var( &mut self, interner: I, db: &dyn UnificationDatabase<I>, variance: Variance, answer_var: BoundVar, pending: GenericArgData<I>, ) -> Fallible<bool>

source

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§

source§

impl<'i, I: Interner> Zipper<I> for AnswerSubstitutor<'i, I>

source§

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.
source§

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.
source§

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.
source§

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.
source§

fn interner(&self) -> I

Retrieves the interner from the underlying zipper object
source§

fn unification_database(&self) -> &dyn UnificationDatabase<I>

Retrieves the UnificationDatabase from the underlying zipper object
§

fn zip_substs( &mut self, ambient: Variance, variances: Option<Variances<I>>, a: &[GenericArg<I>], b: &[GenericArg<I>], ) -> Result<(), NoSolution>
where Self: Sized,

Zips two substs

Auto Trait Implementations§

§

impl<'t, I> Freeze for AnswerSubstitutor<'t, I>
where I: Freeze,

§

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Cast for T

§

fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U
where Self: CastTo<U>, U: HasInterner,

Cast a value to type U using CastTo.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more