Enum rustc_middle::thir::ExprKind[−][src]

pub enum ExprKind<'tcx> {
Show variants Scope { region_scope: Scope, lint_level: LintLevel, value: ExprId, }, Box { value: ExprId, }, If { cond: ExprId, then: ExprId, else_opt: Option<ExprId>, }, Call { ty: Ty<'tcx>, fun: ExprId, args: Box<[ExprId]>, from_hir_call: bool, fn_span: Span, }, Deref { arg: ExprId, }, Binary { op: BinOp, lhs: ExprId, rhs: ExprId, }, LogicalOp { op: LogicalOp, lhs: ExprId, rhs: ExprId, }, Unary { op: UnOp, arg: ExprId, }, Cast { source: ExprId, }, Use { source: ExprId, }, NeverToAny { source: ExprId, }, Pointer { cast: PointerCast, source: ExprId, }, Loop { body: ExprId, }, Match { scrutinee: ExprId, arms: Box<[ArmId]>, }, Block { body: Block, }, Assign { lhs: ExprId, rhs: ExprId, }, AssignOp { op: BinOp, lhs: ExprId, rhs: ExprId, }, Field { lhs: ExprId, name: Field, }, Index { lhs: ExprId, index: ExprId, }, VarRef { id: HirId, }, UpvarRef { closure_def_id: DefId, var_hir_id: HirId, }, Borrow { borrow_kind: BorrowKind, arg: ExprId, }, AddressOf { mutability: Mutability, arg: ExprId, }, Break { label: Scope, value: Option<ExprId>, }, Continue { label: Scope, }, Return { value: Option<ExprId>, }, ConstBlock { value: &'tcx Const<'tcx>, }, Repeat { value: ExprId, count: &'tcx Const<'tcx>, }, Array { fields: Box<[ExprId]>, }, Tuple { fields: Box<[ExprId]>, }, Adt { adt_def: &'tcx AdtDef, variant_index: VariantIdx, substs: SubstsRef<'tcx>, user_ty: Option<Canonical<'tcx, UserType<'tcx>>>, fields: Box<[FieldExpr]>, base: Option<FruInfo<'tcx>>, }, PlaceTypeAscription { source: ExprId, user_ty: Option<Canonical<'tcx, UserType<'tcx>>>, }, ValueTypeAscription { source: ExprId, user_ty: Option<Canonical<'tcx, UserType<'tcx>>>, }, Closure { closure_id: DefId, substs: UpvarSubsts<'tcx>, upvars: Box<[ExprId]>, movability: Option<Movability>, fake_reads: Vec<(ExprId, FakeReadCause, HirId)>, }, Literal { literal: &'tcx Const<'tcx>, user_ty: Option<Canonical<'tcx, UserType<'tcx>>>, const_id: Option<DefId>, }, StaticRef { literal: &'tcx Const<'tcx>, def_id: DefId, }, InlineAsm { template: &'tcx [InlineAsmTemplatePiece], operands: Box<[InlineAsmOperand<'tcx>]>, options: InlineAsmOptions, line_spans: &'tcx [Span], }, ThreadLocalRef(DefId), LlvmInlineAsm { asm: &'tcx LlvmInlineAsmInner, outputs: Box<[ExprId]>, inputs: Box<[ExprId]>, }, Yield { value: ExprId, },
}

Variants

Scope
Show fields

Fields of Scope

region_scope: Scopelint_level: LintLevelvalue: ExprId
Box
Show fields

Fields of Box

value: ExprId
If
Show fields

Fields of If

cond: ExprIdthen: ExprIdelse_opt: Option<ExprId>
Call
Show fields

Fields of Call

ty: Ty<'tcx>fun: ExprIdargs: Box<[ExprId]>from_hir_call: bool

Whether this is from a call in HIR, rather than from an overloaded operator. true for overloaded function call.

fn_span: Span

This Span is the span of the function, without the dot and receiver (e.g. foo(a, b) in x.foo(a, b)

Deref
Show fields

Fields of Deref

arg: ExprId
Binary
Show fields

Fields of Binary

op: BinOplhs: ExprIdrhs: ExprId
LogicalOp
Show fields

Fields of LogicalOp

op: LogicalOplhs: ExprIdrhs: ExprId
Unary
Show fields

Fields of Unary

op: UnOparg: ExprId
Cast
Show fields

Fields of Cast

source: ExprId
Use
Show fields

Fields of Use

source: ExprId
NeverToAny
Show fields

Fields of NeverToAny

source: ExprId
Pointer
Show fields

Fields of Pointer

cast: PointerCastsource: ExprId
Loop
Show fields

Fields of Loop

body: ExprId
Match
Show fields

Fields of Match

scrutinee: ExprIdarms: Box<[ArmId]>
Block
Show fields

Fields of Block

body: Block
Assign
Show fields

Fields of Assign

lhs: ExprIdrhs: ExprId
AssignOp
Show fields

Fields of AssignOp

op: BinOplhs: ExprIdrhs: ExprId
Field
Show fields

Fields of Field

lhs: ExprIdname: Field
Index
Show fields

Fields of Index

lhs: ExprIdindex: ExprId
VarRef
Show fields

Fields of VarRef

id: HirId
UpvarRef

Used to represent upvars mentioned in a closure/generator

Show fields

Fields of UpvarRef

closure_def_id: DefId

DefId of the closure/generator

var_hir_id: HirId

HirId of the root variable

Borrow
Show fields

Fields of Borrow

borrow_kind: BorrowKindarg: ExprId
AddressOf

A &raw [const|mut] $place_expr raw borrow resulting in type *[const|mut] T.

Show fields

Fields of AddressOf

mutability: Mutabilityarg: ExprId
Break
Show fields

Fields of Break

label: Scopevalue: Option<ExprId>
Continue
Show fields

Fields of Continue

label: Scope
Return
Show fields

Fields of Return

value: Option<ExprId>
ConstBlock
Show fields

Fields of ConstBlock

value: &'tcx Const<'tcx>
Repeat
Show fields

Fields of Repeat

value: ExprIdcount: &'tcx Const<'tcx>
Array
Show fields

Fields of Array

fields: Box<[ExprId]>
Tuple
Show fields

Fields of Tuple

fields: Box<[ExprId]>
Adt
Show fields

Fields of Adt

adt_def: &'tcx AdtDefvariant_index: VariantIdxsubsts: SubstsRef<'tcx>user_ty: Option<Canonical<'tcx, UserType<'tcx>>>

Optional user-given substs: for something like let x = Bar::<T> { ... }.

fields: Box<[FieldExpr]>base: Option<FruInfo<'tcx>>
PlaceTypeAscription
Show fields

Fields of PlaceTypeAscription

source: ExprIduser_ty: Option<Canonical<'tcx, UserType<'tcx>>>

Type that the user gave to this expression

ValueTypeAscription
Show fields

Fields of ValueTypeAscription

source: ExprIduser_ty: Option<Canonical<'tcx, UserType<'tcx>>>

Type that the user gave to this expression

Closure
Show fields

Fields of Closure

closure_id: DefIdsubsts: UpvarSubsts<'tcx>upvars: Box<[ExprId]>movability: Option<Movability>fake_reads: Vec<(ExprId, FakeReadCause, HirId)>
Literal
Show fields

Fields of Literal

literal: &'tcx Const<'tcx>user_ty: Option<Canonical<'tcx, UserType<'tcx>>>const_id: Option<DefId>

The DefId of the const item this literal was produced from, if this is not a user-written literal value.

StaticRef

A literal containing the address of a static.

This is only distinguished from Literal so that we can register some info for diagnostics.

Show fields

Fields of StaticRef

literal: &'tcx Const<'tcx>def_id: DefId
InlineAsm
Show fields

Fields of InlineAsm

template: &'tcx [InlineAsmTemplatePiece]operands: Box<[InlineAsmOperand<'tcx>]>options: InlineAsmOptionsline_spans: &'tcx [Span]
ThreadLocalRef(DefId)

An expression taking a reference to a thread local.

LlvmInlineAsm
Show fields

Fields of LlvmInlineAsm

asm: &'tcx LlvmInlineAsmInneroutputs: Box<[ExprId]>inputs: Box<[ExprId]>
Yield
Show fields

Fields of Yield

value: ExprId

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may be different between compiler versions and platforms. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 120 bytes