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,
    },
    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

Fields

§val: i128

The constant value.

§ty: TypeId

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

Evaluates to the given integer literal.

§

ConstPrim

Fields

§val: Sym

The constant value.

Evaluates to the given primitive Rust value.

§

Argument

Fields

§index: TupleIndex

Which of the function’s arguments is this?

One of the arguments to the top-level function.

§

Extractor

Fields

§term: TermId

Which extractor should be called?

§parameter: BindingId

What expression should be passed to the extractor?

The result of calling an external extractor.

§

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.

The result of calling an external constructor.

§

Iterator

Fields

§source: BindingId

Which expression produced the iterator that this consumes?

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

§

MakeVariant

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?

The result of constructing an enum variant.

§

MatchVariant

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.

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.

§

MatchSome

Fields

§source: BindingId

Which binding is being matched?

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

Fields

§source: BindingId

Which binding is being matched?

§field: TupleIndex

Which tuple field are we projecting out?

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

Implementations§

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

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.