pub enum ExprKind {
Show 44 variants
Box {
value: Expr,
},
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,
},
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: AssignOp,
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 {
item: ItemRef,
constructor: Option<VariantInformations>,
},
UpvarRef {
closure_def_id: DefId,
var_hir_id: LocalIdent,
},
Borrow {
borrow_kind: BorrowKind,
arg: Expr,
},
RawBorrow {
mutability: Mutability,
arg: Expr,
},
Break {
label: Scope,
value: Option<Expr>,
},
Continue {
label: Scope,
},
Return {
value: Option<Expr>,
},
ConstBlock(ItemRef),
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 {
item: ItemRef,
user_ty: Option<CanonicalUserType>,
},
ConstParam {
param: ParamConst,
def_id: GlobalIdent,
},
StaticRef {
alloc_id: u64,
ty: Ty,
def_id: GlobalIdent,
},
Yield {
value: Expr,
},
Todo(String),
}
Expand description
Reflects thir::ExprKind
Variants§
Box
If
Resugared macros calls. This is deprecated: see https://github.com/hacspec/hax/issues/145.
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
.
In the case of a call to a function that’s not a closure/fn pointer, the expression
will be a GlobalName
that contains all the information about generics and whether
this is a direct call or a method call.
Deref
Binary
LogicalOp
Unary
Cast
Use
NeverToAny
PointerCoercion
Loop
Match
Let
Block
Assign
AssignOp
Field
TupleField
Index
VarRef
Fields
§
id: LocalIdent
ConstRef
Fields
§
id: ParamConst
GlobalName
UpvarRef
Borrow
RawBorrow
Break
Continue
Return
ConstBlock(ItemRef)
Repeat
Array
Tuple
Adt(AdtExpr)
PlaceTypeAscription
ValueTypeAscription
Closure
Literal
ZstLiteral
Fields
§
user_ty: Option<CanonicalUserType>
NamedConst
ConstParam
StaticRef
Yield
Todo(String)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ExprKind
impl<'de> Deserialize<'de> for ExprKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 JsonSchema for ExprKind
impl JsonSchema for ExprKind
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreAuto Trait Implementations§
impl Freeze for ExprKind
impl RefUnwindSafe for ExprKind
impl Send for ExprKind
impl Sync for ExprKind
impl Unpin for ExprKind
impl UnwindSafe for ExprKind
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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