Enum hax_frontend_exporter::ExprKind

source ·
pub enum ExprKind {
Show 45 variants Box { value: Expr, }, MacroInvokation(MacroInvokation), If { if_then_scope: Scope, cond: Expr, then: Expr, else_opt: Option<Expr>, }, Call { ty: Ty, fun: Expr, args: Vec<Expr>, from_hir_call: bool, fn_span: Span, generic_args: Vec<GenericArg>, bounds_impls: Vec<ImplExpr>, trait: Option<(ImplExpr, Vec<GenericArg>)>, }, Deref { arg: Expr, }, Binary { op: BinOp, lhs: Expr, rhs: Expr, }, LogicalOp { op: LogicalOp, lhs: Expr, rhs: Expr, }, Unary { op: UnOp, arg: Expr, }, Cast { source: Expr, }, Use { source: Expr, }, NeverToAny { source: Expr, }, PointerCoercion { cast: PointerCoercion, source: Expr, }, Loop { body: Expr, }, Match { scrutinee: Expr, arms: Vec<Arm>, }, Let { expr: Expr, pat: Pat, }, Block { block: Block, }, Assign { lhs: Expr, rhs: Expr, }, AssignOp { op: BinOp, lhs: Expr, rhs: Expr, }, Field { field: DefId, lhs: Expr, }, TupleField { field: usize, lhs: Expr, }, Index { lhs: Expr, index: Expr, }, VarRef { id: LocalIdent, }, ConstRef { id: ParamConst, }, GlobalName { id: GlobalIdent, }, UpvarRef { closure_def_id: DefId, var_hir_id: LocalIdent, }, Borrow { borrow_kind: BorrowKind, arg: Expr, }, AddressOf { mutability: Mutability, arg: Expr, }, Break { label: Scope, value: Option<Expr>, }, Continue { label: Scope, }, Return { value: Option<Expr>, }, ConstBlock { did: DefId, args: Vec<GenericArg>, }, Repeat { value: Expr, count: ConstantExpr, }, Array { fields: Vec<Expr>, }, Tuple { fields: Vec<Expr>, }, Adt(AdtExpr), PlaceTypeAscription { source: Expr, user_ty: Option<CanonicalUserType>, }, ValueTypeAscription { source: Expr, user_ty: Option<CanonicalUserType>, }, Closure { params: Vec<Param>, body: Expr, upvars: Vec<Expr>, movability: Option<Movability>, }, Literal { lit: Spanned<LitKind>, neg: bool, }, ZstLiteral { user_ty: Option<CanonicalUserType>, }, NamedConst { def_id: GlobalIdent, args: Vec<GenericArg>, user_ty: Option<CanonicalUserType>, impl: Option<ImplExpr>, }, ConstParam { param: ParamConst, def_id: GlobalIdent, }, StaticRef { alloc_id: u64, ty: Ty, def_id: GlobalIdent, }, Yield { value: Expr, }, Todo(String),
}
Expand description

Variants§

§

Box

Fields

§value: Expr
§

MacroInvokation(MacroInvokation)

§

If

Resugared macros calls. This is deprecated: see https://github.com/hacspec/hax/issues/145.

Fields

§if_then_scope: Scope
§cond: Expr
§then: Expr
§else_opt: Option<Expr>
§

Call

A call to a function or a method.

Example: f(0i8), where f has signature fn f<T: Clone>(t: T) -> ().

Fields

§ty: Ty

The type of the function, substitution applied.

Example: for the call f(0i8), this is i8 -> ().

§fun: Expr

The function itself. This can be something else than a name, e.g. a closure.

Example: for the call f(0i8), this is f.

§args: Vec<Expr>

The arguments given to the function.

Example: for the call f(0i8), this is [0i8].

§from_hir_call: bool
§fn_span: Span
§generic_args: Vec<GenericArg>

The generic arguments given to the function.

Example: for the call f(0i8), this is the type i8.

§bounds_impls: Vec<ImplExpr>

The implementations for the bounds of the function.

Example: for the call f(0i8), this is two implementation expressions, one for the explicit bound i8: Clone and one for the implicit i8: Sized.

§trait: Option<(ImplExpr, Vec<GenericArg>)>

trait is None if this is a function call or a method to an inherent trait. If this is a method call from a trait Trait, then it contains the concrete implementation of Trait it is called on, and the generic arguments that comes from the trait declaration.

Example: f(0i8) is a function call, hence the field impl is None.

Example:

trait MyTrait<TraitType, const TraitConst: usize> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType, 12>>(x: SelfType) {
  x.meth::<String>(...)
}

Here, in the call x.meth::<String>(...), r#trait will be Some((..., [SelfType, TraitType, 12])), and generic_args will be [String].

§

Deref

Fields

§arg: Expr
§

Binary

Fields

§lhs: Expr
§rhs: Expr
§

LogicalOp

Fields

§lhs: Expr
§rhs: Expr
§

Unary

Fields

§op: UnOp
§arg: Expr
§

Cast

Fields

§source: Expr
§

Use

Fields

§source: Expr
§

NeverToAny

Fields

§source: Expr
§

PointerCoercion

Fields

§source: Expr
§

Loop

Fields

§body: Expr
§

Match

Fields

§scrutinee: Expr
§arms: Vec<Arm>
§

Let

Fields

§expr: Expr
§pat: Pat
§

Block

Fields

§block: Block
§

Assign

Fields

§lhs: Expr
§rhs: Expr
§

AssignOp

Fields

§lhs: Expr
§rhs: Expr
§

Field

Fields

§field: DefId
§lhs: Expr
§

TupleField

Fields

§field: usize
§lhs: Expr
§

Index

Fields

§lhs: Expr
§index: Expr
§

VarRef

Fields

§

ConstRef

Fields

§

GlobalName

Fields

§

UpvarRef

Fields

§closure_def_id: DefId
§var_hir_id: LocalIdent
§

Borrow

Fields

§borrow_kind: BorrowKind
§arg: Expr
§

AddressOf

Fields

§mutability: Mutability
§arg: Expr
§

Break

Fields

§label: Scope
§value: Option<Expr>
§

Continue

Fields

§label: Scope
§

Return

Fields

§value: Option<Expr>
§

ConstBlock

Fields

§did: DefId
§

Repeat

Fields

§value: Expr
§

Array

Fields

§fields: Vec<Expr>
§

Tuple

Fields

§fields: Vec<Expr>
§

Adt(AdtExpr)

§

PlaceTypeAscription

Fields

§source: Expr
§

ValueTypeAscription

Fields

§source: Expr
§

Closure

Fields

§params: Vec<Param>
§body: Expr
§upvars: Vec<Expr>
§movability: Option<Movability>
§

Literal

Fields

§neg: bool
§

ZstLiteral

Fields

§

NamedConst

§

ConstParam

Fields

§

StaticRef

Fields

§alloc_id: u64
§ty: Ty
§

Yield

Fields

§value: Expr
§

Todo(String)

Trait Implementations§

source§

impl<'__de> BorrowDecode<'__de> for ExprKind

source§

fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
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 Debug for ExprKind

source§

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

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

impl Decode for ExprKind

source§

fn decode<__D: Decoder>(decoder: &mut __D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
source§

impl<'de> Deserialize<'de> for ExprKind

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Encode for ExprKind

source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
source§

impl JsonSchema for ExprKind

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl<'tcx, S: ExprState<'tcx>> SInto<S, ExprKind> for ExprKind<'tcx>

source§

fn sinto(&self, gstate: &S) -> ExprKind

source§

impl Serialize for ExprKind

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

§

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

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,