Struct chalk_engine::FlounderedSubgoal [−][src]
pub struct FlounderedSubgoal<I: Interner> { pub floundered_literal: Literal<I>, pub floundered_time: TimeStamp, }
Expand description
A “floundered” subgoal is one that contains unbound existential variables for which it cannot produce a value. The classic example of floundering is a negative subgoal:
not { Implemented(?T: Foo) }
The way the prolog solver works, it basically enumerates all the
ways that a given goal can be true. But we can’t use this
technique to find all the ways that ?T: Foo
can be false – so
we call it floundered. In other words, we can evaluate a negative
goal, but only if we know what ?T
is – we can’t use the
negative goal to help us figuring out ?T
.
In addition to negative goals, we use floundering to prevent the
trait solver from trying to enumerate very large goals with tons
of answers. For example, we consider a goal like ?T: Sized
to
“flounder”, since we can’t hope to enumerate all types that are
Sized
. The same is true for other special traits like Clone
.
Floundering can also occur indirectly. For example:
trait Foo { } impl<T> Foo for T { }
trying to solve ?T: Foo
would immediately require solving ?T: Sized
, and hence would flounder.
Fields
floundered_literal: Literal<I>
Literal that floundered.
floundered_time: TimeStamp
Current value of the strand’s clock at the time of floundering.
Trait Implementations
type Result = FlounderedSubgoal<I>
type Result = FlounderedSubgoal<I>
The type of value that will be produced once folding is done.
Typically this is Self
, unless Self
contains borrowed
values, in which case owned values are produced (for example,
one can fold over a &T
value where T: Fold
, in which case
you get back a T
, not a &T
). Read more
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. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
fn visit_with<'i, B>(
&self,
visitor: &mut dyn Visitor<'i, I, BreakTy = B>,
outer_binder: DebruijnIndex
) -> ControlFlow<B> where
I: 'i,
fn visit_with<'i, B>(
&self,
visitor: &mut dyn Visitor<'i, I, BreakTy = B>,
outer_binder: DebruijnIndex
) -> ControlFlow<B> where
I: 'i,
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. Read more
Auto Trait Implementations
impl<I> RefUnwindSafe for FlounderedSubgoal<I> where
<I as Interner>::InternedGoal: RefUnwindSafe,
<I as Interner>::InternedProgramClauses: RefUnwindSafe,
impl<I> Send for FlounderedSubgoal<I> where
<I as Interner>::InternedGoal: Send,
<I as Interner>::InternedProgramClauses: Send,
impl<I> Sync for FlounderedSubgoal<I> where
<I as Interner>::InternedGoal: Sync,
<I as Interner>::InternedProgramClauses: Sync,
impl<I> Unpin for FlounderedSubgoal<I> where
<I as Interner>::InternedGoal: Unpin,
<I as Interner>::InternedProgramClauses: Unpin,
impl<I> UnwindSafe for FlounderedSubgoal<I> where
<I as Interner>::InternedGoal: UnwindSafe,
<I as Interner>::InternedProgramClauses: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
fn 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
.
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Shifts this term in one level of binders.
pub fn shifted_in_from(
self,
interner: &I,
source_binder: DebruijnIndex
) -> <T as Fold<I>>::Result
pub fn shifted_in_from(
self,
interner: &I,
source_binder: DebruijnIndex
) -> <T as Fold<I>>::Result
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. Read more
pub fn shifted_out_to(
self,
interner: &I,
target_binder: DebruijnIndex
) -> Result<<T as Fold<I>>::Result, NoSolution>
pub fn shifted_out_to(
self,
interner: &I,
target_binder: DebruijnIndex
) -> Result<<T as Fold<I>>::Result, 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. Read more
Shifts this term out one level of binders.