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,
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 {
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
Reflects thir::ExprKind
Variants§
Box
MacroInvokation(MacroInvokation)
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
.
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
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
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>,
source§impl JsonSchema for ExprKind
impl JsonSchema for ExprKind
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$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
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)
clone_to_uninit
)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>
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>
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