pub enum Binding {
ConstInt {
val: i128,
ty: TypeId,
},
ConstPrim {
val: Sym,
},
Argument {
index: TupleIndex,
},
Extractor {
term: TermId,
parameter: BindingId,
},
Constructor {
term: TermId,
parameters: Box<[BindingId]>,
instance: u32,
},
Iterator {
source: BindingId,
},
MakeVariant {
ty: TypeId,
variant: VariantId,
fields: Box<[BindingId]>,
},
MatchVariant {
source: BindingId,
variant: VariantId,
field: TupleIndex,
},
MakeSome {
inner: BindingId,
},
MatchSome {
source: BindingId,
},
MatchTuple {
source: BindingId,
field: TupleIndex,
},
}
Expand description
Bindings are anything which can be bound to a variable name in Rust. This includes expressions, such as constants or function calls; but it also includes names bound in pattern matches.
Variants§
ConstInt
Evaluates to the given integer literal.
Fields
ConstPrim
Evaluates to the given primitive Rust value.
Argument
One of the arguments to the top-level function.
Fields
index: TupleIndex
Which of the function’s arguments is this?
Extractor
The result of calling an external extractor.
Fields
Constructor
The result of calling an external constructor.
Fields
Iterator
The result of getting one value from a multi-constructor or multi-extractor.
MakeVariant
The result of constructing an enum variant.
Fields
MatchVariant
Pattern-match one of the previous bindings against an enum variant and produce a new binding
from one of its fields. There must be a corresponding Constraint::Variant for each
source
/variant
pair that appears in some MatchVariant
binding.
Fields
variant: VariantId
Which enum variant are we pulling binding sites from? This is somewhat redundant with information in a corresponding Constraint. However, it must be here so that different enum variants aren’t hash-consed into the same binding site.
field: TupleIndex
Which field of this enum variant are we projecting out? Although ISLE uses named fields, we track them by index for constant-time comparisons. The sema::TypeEnv can be used to get the field names.
MakeSome
The result of constructing an Option::Some variant.
MatchSome
Pattern-match one of the previous bindings against Option::Some
and produce a new binding
from its contents. There must be a corresponding Constraint::Some for each source
that
appears in a MatchSome
binding. (This currently only happens with external extractors.)
MatchTuple
Pattern-match one of the previous bindings against a tuple and produce a new binding from one of its fields. This is an irrefutable pattern match so there is no corresponding Constraint. (This currently only happens with external extractors.)
Fields
field: TupleIndex
Which tuple field are we projecting out?
Implementations§
Trait Implementations§
impl Eq for Binding
impl StructuralPartialEq for Binding
Auto Trait Implementations§
impl Freeze for Binding
impl RefUnwindSafe for Binding
impl Send for Binding
impl Sync for Binding
impl Unpin for Binding
impl UnwindSafe for Binding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)