flux_middle::rty::expr

Enum ExprKind

Source
pub enum ExprKind {
Show 17 variants Var(Var), Local(Local), Constant(Constant), ConstDefId(DefId), BinaryOp(BinOp, Expr, Expr), GlobalFunc(Symbol, SpecFuncKind), UnaryOp(UnOp, Expr), FieldProj(Expr, FieldProj), Aggregate(AggregateKind, List<Expr>), PathProj(Expr, FieldIdx), IfThenElse(Expr, Expr, Expr), KVar(KVar), Alias(AliasReft, List<Expr>), App(Expr, List<Expr>), Abs(Lambda), Hole(HoleKind), ForAll(Binder<Expr>),
}

Variants§

§

Var(Var)

§

Local(Local)

§

Constant(Constant)

§

ConstDefId(DefId)

§

BinaryOp(BinOp, Expr, Expr)

§

GlobalFunc(Symbol, SpecFuncKind)

§

UnaryOp(UnOp, Expr)

§

FieldProj(Expr, FieldProj)

§

Aggregate(AggregateKind, List<Expr>)

§

PathProj(Expr, FieldIdx)

§

IfThenElse(Expr, Expr, Expr)

§

KVar(KVar)

§

Alias(AliasReft, List<Expr>)

§

App(Expr, List<Expr>)

Function application. The syntax allows arbitrary expressions in function position, but in practice we are restricted by what’s possible to encode in fixpoint. In a nutshell, we need to make sure that expressions that can’t be encoded are eliminated before we generate the fixpoint constraint. Most notably, lambda abstractions have to be fully applied before encoding into fixpoint (except when they appear as an index at the top-level).

§

Abs(Lambda)

Lambda abstractions. They are purely syntactic and we don’t encode them in the logic. As such, they have some syntactic restrictions that we must carefully maintain:

  1. They can appear as an index at the top level.
  2. We can only substitute an abstraction for a variable in function position (or as an index). More generally, we need to partially evaluate expressions such that all abstractions in non-index position are eliminated before encoding into fixpoint. Right now, the implementation only evaluates abstractions that are immediately applied to arguments, thus the restriction.
§

Hole(HoleKind)

A hole is an expression that must be inferred either semantically by generating a kvar or syntactically by generating an evar. Whether a hole can be inferred semantically or syntactically depends on the position it appears: only holes appearing in predicate position can be inferred with a kvar (provided it satisfies the fixpoint horn constraints) and only holes used as an index (a position that fully determines their value) can be inferred with an evar.

Holes are implicitly defined in a scope, i.e., their solution could mention free and bound variables in this scope. This must be considered when generating an inference variables for them (either evar or kvar). In fact, the main reason we have holes is that we want to decouple the places where we generate holes (where we don’t want to worry about the scope), and the places where we generate inference variable for them (where we do need to worry about the scope).

§

ForAll(Binder<Expr>)

Implementations§

Trait Implementations§

Source§

impl Clone for ExprKind

Source§

fn clone(&self) -> ExprKind

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<__D: TyDecoder> Decodable<__D> for ExprKind

Source§

fn decode(__decoder: &mut __D) -> Self

Source§

impl<__E: TyEncoder> Encodable<__E> for ExprKind

Source§

fn encode(&self, __encoder: &mut __E)

Source§

impl Hash for ExprKind

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 Internable for ExprKind

Source§

fn storage() -> &'static InternStorage<Self>

Source§

impl PartialEq for ExprKind

Source§

fn eq(&self, other: &ExprKind) -> 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 ExprKind

Source§

impl StructuralPartialEq for ExprKind

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§

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoQueryParam<P> for P

Source§

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

Source§

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

Source§

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

Source§

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.