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,
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
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: TyThe type of the function, substitution applied.
Example: for the call f(0i8), this is i8 -> ().
fun: ExprThe 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: LocalIdentConstRef
Fields
id: ParamConstGlobalName
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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &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§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