Struct flux_middle::rty::Expr
source · pub struct Expr {
kind: Interned<ExprKind>,
espan: Option<ESpan>,
}
Fields§
§kind: Interned<ExprKind>
§espan: Option<ESpan>
Implementations§
source§impl Expr
impl Expr
pub fn at_opt(self, espan: Option<ESpan>) -> Expr
pub fn at(self, espan: ESpan) -> Expr
pub fn at_base(self, base: ESpan) -> Expr
pub fn span(&self) -> Option<ESpan>
pub fn tt() -> Expr
pub fn ff() -> Expr
pub fn and_from_iter(exprs: impl IntoIterator<Item = Expr>) -> Expr
pub fn or_from_iter(exprs: impl IntoIterator<Item = Expr>) -> Expr
pub fn and(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn or(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn zero() -> Expr
pub fn int_max(int_ty: IntTy) -> Expr
pub fn int_min(int_ty: IntTy) -> Expr
pub fn uint_max(uint_ty: UintTy) -> Expr
pub fn nu() -> Expr
pub fn is_nu(&self) -> bool
pub fn expect_adt(&self) -> (DefId, List<Expr>)
pub fn unit() -> Expr
pub fn var(var: Var) -> Expr
pub fn fvar(name: Name) -> Expr
pub fn evar(evar: EVar) -> Expr
pub fn bvar(debruijn: DebruijnIndex, var: BoundVar, kind: BoundReftKind) -> Expr
pub fn early_param(index: u32, name: Symbol) -> Expr
pub fn local(local: Local) -> Expr
pub fn constant(c: Constant) -> Expr
pub fn const_def_id(c: DefId) -> Expr
pub fn const_generic(param: ParamConst) -> Expr
pub fn aggregate(kind: AggregateKind, flds: List<Expr>) -> Expr
pub fn tuple(flds: List<Expr>) -> Expr
pub fn adt(def_id: DefId, flds: List<Expr>) -> Expr
pub fn from_bits(bty: &BaseTy, bits: u128) -> Expr
pub fn ite(p: impl Into<Expr>, e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn abs(lam: Lambda) -> Expr
pub fn hole(kind: HoleKind) -> Expr
pub fn kvar(kvar: KVar) -> Expr
pub fn alias(alias: AliasReft, args: List<Expr>) -> Expr
pub fn forall(expr: Binder<Expr>) -> Expr
pub fn binary_op(op: BinOp, e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn unit_adt(def_id: DefId) -> Expr
pub fn app(func: impl Into<Expr>, args: List<Expr>) -> Expr
pub fn global_func(func: Symbol, kind: SpecFuncKind) -> Expr
pub fn eq(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn unary_op(op: UnOp, e: impl Into<Expr>) -> Expr
pub fn ne(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn ge(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn gt(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn lt(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn le(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn implies(e1: impl Into<Expr>, e2: impl Into<Expr>) -> Expr
pub fn field_proj(e: impl Into<Expr>, proj: FieldProj) -> Expr
pub fn field_projs(e: impl Into<Expr>, projs: &[FieldProj]) -> Expr
pub fn path_proj(base: Expr, field: FieldIdx) -> Expr
pub fn not(&self) -> Expr
pub fn neg(&self) -> Expr
pub fn kind(&self) -> &ExprKind
sourcepub fn is_atom(&self) -> bool
pub fn is_atom(&self) -> bool
An expression is an atom if it is “self-delimiting”, i.e., it has a clear boundary when printed. This is used to avoid unnecessary parenthesis when pretty printing.
sourcepub fn is_trivially_true(&self) -> bool
pub fn is_trivially_true(&self) -> bool
Simple syntactic check to see if the expression is a trivially true predicate. This is used mostly for filtering predicates when pretty printing but also to simplify types in general.
sourcepub fn is_trivially_false(&self) -> bool
pub fn is_trivially_false(&self) -> bool
Simple syntactic check to see if the expression is a trivially false predicate.
pub fn from_const(tcx: TyCtxt<'_>, c: &Const) -> Expr
pub fn is_binary_op(&self) -> bool
fn const_op(op: &BinOp, c1: &Constant, c2: &Constant) -> Option<Constant>
sourcepub fn simplify(&self) -> Expr
pub fn simplify(&self) -> Expr
Simplify the expression by removing double negations, short-circuiting boolean connectives and
doing constant folding. Note that we also have TypeFoldable::normalize
which applies beta
reductions for tuples and abstractions.
pub fn to_loc(&self) -> Option<Loc>
pub fn to_path(&self) -> Option<Path>
pub fn is_abs(&self) -> bool
pub fn eta_expand_abs( &self, inputs: &BoundVariableKinds, output: Sort, ) -> Lambda
pub fn fold_sort(sort: &Sort, f: impl FnMut(&Sort) -> Expr) -> Expr
sourcepub fn proj_and_reduce(&self, proj: FieldProj) -> Expr
pub fn proj_and_reduce(&self, proj: FieldProj) -> Expr
Applies a field projection to an expression and optimistically try to beta reduce it
pub fn flatten_conjs(&self) -> Vec<&Expr>
Trait Implementations§
source§impl SliceInternable for Expr
impl SliceInternable for Expr
fn storage() -> &'static InternStorage<[Self]>
source§impl TypeFoldable for Expr
impl TypeFoldable for Expr
fn try_fold_with<F: FallibleTypeFolder>( &self, folder: &mut F, ) -> Result<Self, F::Error>
fn fold_with<F: TypeFolder>(&self, folder: &mut F) -> Self
fn normalize_projections<'tcx>( &self, genv: GlobalEnv<'_, 'tcx>, infcx: &InferCtxt<'tcx>, callsite_def_id: DefId, ) -> QueryResult<Self>
source§fn normalize(&self, defns: &SpecFuncDefns) -> Self
fn normalize(&self, defns: &SpecFuncDefns) -> Self
Normalize expressions by applying beta reductions for tuples and lambda abstractions.
source§fn replace_holes(
&self,
f: impl FnMut(&[BoundVariableKinds], HoleKind) -> Expr,
) -> Self
fn replace_holes( &self, f: impl FnMut(&[BoundVariableKinds], HoleKind) -> Expr, ) -> Self
Replaces all holes with the result of calling a closure. The closure takes a list with
all the layers of bound variables at the point the hole was found. Each layer corresponds
to the list of bound variables at that level. The list is ordered from outermost to innermost
binder, i.e., the last element is the binder closest to the hole.
source§fn with_holes(&self) -> Self
fn with_holes(&self) -> Self
Remove all refinements and turn each underlying
BaseTy
into a TyKind::Exists
with a
TyKind::Constr
and a hole
. For example, Vec<{v. i32[v] | v > 0}>[n]
becomes
{n. Vec<{v. i32[v] | *}>[n] | *}
.fn replace_evars(&self, evars: &EVarSol) -> Self
fn shift_in_escaping(&self, amount: u32) -> Self
fn shift_out_escaping(&self, amount: u32) -> Self
fn erase_regions(&self) -> Self
source§impl TypeSuperFoldable for Expr
impl TypeSuperFoldable for Expr
fn try_super_fold_with<F: FallibleTypeFolder>( &self, folder: &mut F, ) -> Result<Self, F::Error>
fn super_fold_with<F: TypeFolder>(&self, folder: &mut F) -> Self
source§impl TypeSuperVisitable for Expr
impl TypeSuperVisitable for Expr
fn super_visit_with<V: TypeVisitor>( &self, visitor: &mut V, ) -> ControlFlow<V::BreakTy>
source§impl TypeVisitable for Expr
impl TypeVisitable for Expr
fn visit_with<V: TypeVisitor>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy>
fn has_escaping_bvars(&self) -> bool
source§fn has_escaping_bvars_at_or_above(&self, binder: DebruijnIndex) -> bool
fn has_escaping_bvars_at_or_above(&self, binder: DebruijnIndex) -> bool
Returns
true
if self
has any late-bound vars that are either
bound by binder
or bound by some binder outside of binder
.
If binder
is ty::INNERMOST
, this indicates whether
there are any late-bound vars that appear free.impl Eq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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