pub struct Goal<I: Interner> {
pub(crate) interned: I::InternedGoal,
}
Expand description
A general goal; this is the full range of questions you can pose to Chalk.
Fields§
§interned: I::InternedGoal
Implementations§
source§impl<I: Interner> Goal<I>
impl<I: Interner> Goal<I>
sourcepub fn interned(&self) -> &I::InternedGoal
pub fn interned(&self) -> &I::InternedGoal
Gets the interned goal.
sourcepub fn quantify(
self,
interner: I,
kind: QuantifierKind,
binders: VariableKinds<I>,
) -> Goal<I>
pub fn quantify( self, interner: I, kind: QuantifierKind, binders: VariableKinds<I>, ) -> Goal<I>
Create a goal using a forall
or exists
quantifier.
sourcepub fn compatible(self, interner: I) -> Self
pub fn compatible(self, interner: I) -> Self
Takes a goal G
and turns it into compatible { G }
.
sourcepub fn implied_by(self, interner: I, predicates: ProgramClauses<I>) -> Goal<I>
pub fn implied_by(self, interner: I, predicates: ProgramClauses<I>) -> Goal<I>
Create an implication goal that holds if the predicates are true.
sourcepub fn is_trivially_true(&self, interner: I) -> bool
pub fn is_trivially_true(&self, interner: I) -> bool
True if this goal is “trivially true” – i.e., no work is required to prove it.
Trait Implementations§
source§impl<I: Interner, T: HasInterner<Interner = I> + CastTo<Goal<I>>> CastTo<Goal<I>> for Binders<T>
impl<I: Interner, T: HasInterner<Interner = I> + CastTo<Goal<I>>> CastTo<Goal<I>> for Binders<T>
source§impl<I: Interner> HasInterner for Goal<I>
impl<I: Interner> HasInterner for Goal<I>
source§impl<I: Ord + Interner> Ord for Goal<I>where
I::InternedGoal: Ord,
impl<I: Ord + Interner> Ord for Goal<I>where
I::InternedGoal: Ord,
source§impl<I: PartialEq + Interner> PartialEq for Goal<I>where
I::InternedGoal: PartialEq,
impl<I: PartialEq + Interner> PartialEq for Goal<I>where
I::InternedGoal: PartialEq,
source§impl<I: PartialOrd + Interner> PartialOrd for Goal<I>where
I::InternedGoal: PartialOrd,
impl<I: PartialOrd + Interner> PartialOrd for Goal<I>where
I::InternedGoal: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<I: Interner> TypeFoldable<I> for Goal<I>
impl<I: Interner> TypeFoldable<I> for Goal<I>
Folding a goal invokes the fold_goal
callback (which will, by
default, invoke super-fold).
source§fn try_fold_with<E>(
self,
folder: &mut dyn FallibleTypeFolder<I, Error = E>,
outer_binder: DebruijnIndex,
) -> Result<Self, E>
fn try_fold_with<E>( self, folder: &mut dyn FallibleTypeFolder<I, Error = E>, outer_binder: DebruijnIndex, ) -> Result<Self, E>
Apply the given folder
folder
to self
; binders
is the
number of binders that are in scope when beginning the
folder. Typically binders
starts as 0, but is adjusted when
we encounter Binders<T>
in the IR or other similar
constructs.source§fn fold_with(
self,
folder: &mut dyn TypeFolder<I>,
outer_binder: DebruijnIndex,
) -> Self
fn fold_with( self, folder: &mut dyn TypeFolder<I>, outer_binder: DebruijnIndex, ) -> Self
A convenient alternative to
try_fold_with
for use with infallible
folders. Do not override this method, to ensure coherence with
try_fold_with
.source§impl<I: Interner> TypeSuperFoldable<I> for Goal<I>
impl<I: Interner> TypeSuperFoldable<I> for Goal<I>
Superfold folds recursively.
source§fn try_super_fold_with<E>(
self,
folder: &mut dyn FallibleTypeFolder<I, Error = E>,
outer_binder: DebruijnIndex,
) -> Result<Self, E>
fn try_super_fold_with<E>( self, folder: &mut dyn FallibleTypeFolder<I, Error = E>, outer_binder: DebruijnIndex, ) -> Result<Self, E>
Recursively folds the value.
source§fn super_fold_with(
self,
folder: &mut dyn TypeFolder<I>,
outer_binder: DebruijnIndex,
) -> Self
fn super_fold_with( self, folder: &mut dyn TypeFolder<I>, outer_binder: DebruijnIndex, ) -> Self
A convenient alternative to
try_super_fold_with
for use with
infallible folders. Do not override this method, to ensure coherence
with try_super_fold_with
.source§impl<I: Interner> TypeSuperVisitable<I> for Goal<I>
impl<I: Interner> TypeSuperVisitable<I> for Goal<I>
source§fn super_visit_with<B>(
&self,
visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
outer_binder: DebruijnIndex,
) -> ControlFlow<B>
fn super_visit_with<B>( &self, visitor: &mut dyn TypeVisitor<I, BreakTy = B>, outer_binder: DebruijnIndex, ) -> ControlFlow<B>
Recursively visits the type contents.
source§impl<I: Interner> TypeVisitable<I> for Goal<I>
impl<I: Interner> TypeVisitable<I> for Goal<I>
source§fn visit_with<B>(
&self,
visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
outer_binder: DebruijnIndex,
) -> ControlFlow<B>
fn visit_with<B>( &self, visitor: &mut dyn TypeVisitor<I, BreakTy = B>, outer_binder: DebruijnIndex, ) -> ControlFlow<B>
Apply the given visitor
visitor
to self
; binders
is the
number of binders that are in scope when beginning the
visitor. Typically binders
starts as 0, but is adjusted when
we encounter Binders<T>
in the IR or other similar
constructs.impl<I: Copy + Interner> Copy for Goal<I>where
I::InternedGoal: Copy,
impl<I: Eq + Interner> Eq for Goal<I>where
I::InternedGoal: Eq,
impl<I: Interner> StructuralPartialEq for Goal<I>
Auto Trait Implementations§
impl<I> Freeze for Goal<I>
impl<I> RefUnwindSafe for Goal<I>
impl<I> Send for Goal<I>
impl<I> Sync for Goal<I>
impl<I> Unpin for Goal<I>
impl<I> UnwindSafe for Goal<I>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T, I> CouldMatch<T> for T
impl<T, I> CouldMatch<T> for T
source§fn could_match(
&self,
interner: I,
db: &dyn UnificationDatabase<I>,
other: &T,
) -> bool
fn could_match( &self, interner: I, db: &dyn UnificationDatabase<I>, other: &T, ) -> bool
Checks whether
self
and other
could possibly match.source§impl<T, I> Shift<I> for Twhere
T: TypeFoldable<I>,
I: Interner,
impl<T, I> Shift<I> for Twhere
T: TypeFoldable<I>,
I: Interner,
source§fn shifted_in(self, interner: I) -> T
fn shifted_in(self, interner: I) -> T
Shifts this term in one level of binders.
source§fn shifted_in_from(self, interner: I, source_binder: DebruijnIndex) -> T
fn shifted_in_from(self, interner: I, source_binder: DebruijnIndex) -> T
Shifts a term valid at
outer_binder
so that it is
valid at the innermost binder. See DebruijnIndex::shifted_in_from
for a detailed explanation.source§fn shifted_out_to(
self,
interner: I,
target_binder: DebruijnIndex,
) -> Result<T, NoSolution>
fn shifted_out_to( self, interner: I, target_binder: DebruijnIndex, ) -> Result<T, NoSolution>
Shifts a term valid at the innermost binder so that it is
valid at
outer_binder
. See DebruijnIndex::shifted_out_to
for a detailed explanation.source§fn shifted_out(self, interner: I) -> Result<T, NoSolution>
fn shifted_out(self, interner: I) -> Result<T, NoSolution>
Shifts this term out one level of binders.
source§impl<T, I> VisitExt<I> for Twhere
I: Interner,
T: TypeVisitable<I>,
impl<T, I> VisitExt<I> for Twhere
I: Interner,
T: TypeVisitable<I>,
source§fn has_free_vars(&self, interner: I) -> bool
fn has_free_vars(&self, interner: I) -> bool
Check whether there are free (non-bound) variables.