Enum cranelift_isle::trie_again::Binding

source ·
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

§val: i128

The constant value.

§ty: TypeId

The constant’s type. Unsigned types preserve the representation of val, not its value.

§

ConstPrim

Evaluates to the given primitive Rust value.

Fields

§val: Sym

The constant 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

§term: TermId

Which extractor should be called?

§parameter: BindingId

What expression should be passed to the extractor?

§

Constructor

The result of calling an external constructor.

Fields

§term: TermId

Which constructor should be called?

§parameters: Box<[BindingId]>

What expressions should be passed to the constructor?

§instance: u32

For impure constructors, a unique number for each use of this term. Always 0 for pure constructors.

§

Iterator

The result of getting one value from a multi-constructor or multi-extractor.

Fields

§source: BindingId

Which expression produced the iterator that this consumes?

§

MakeVariant

The result of constructing an enum variant.

Fields

§ty: TypeId

Which enum type should be constructed?

§variant: VariantId

Which variant of that enum should be constructed?

§fields: Box<[BindingId]>

What expressions should be provided for this variant’s 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

§source: BindingId

Which binding is being matched?

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

Fields

§inner: BindingId

Contained expression.

§

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

Fields

§source: BindingId

Which binding is being matched?

§

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

§source: BindingId

Which binding is being matched?

§field: TupleIndex

Which tuple field are we projecting out?

Implementations§

source§

impl Binding

source

pub fn sources(&self) -> &[BindingId]

Returns the binding sites which must be evaluated before this binding.

Trait Implementations§

source§

impl Clone for Binding

source§

fn clone(&self) -> Binding

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Binding

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Binding

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Binding

source§

fn eq(&self, other: &Binding) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Binding

source§

impl StructuralPartialEq for Binding

Auto Trait Implementations§

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

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.