Enum rustc::hir::ExprKind [−][src]
pub enum ExprKind {
Box(P<Expr>),
Array(HirVec<Expr>),
Call(P<Expr>, HirVec<Expr>),
MethodCall(PathSegment, Span, HirVec<Expr>),
Tup(HirVec<Expr>),
Binary(BinOp, P<Expr>, P<Expr>),
Unary(UnOp, P<Expr>),
Lit(P<Lit>),
Cast(P<Expr>, P<Ty>),
Type(P<Expr>, P<Ty>),
If(P<Expr>, P<Expr>, Option<P<Expr>>),
While(P<Expr>, P<Block>, Option<Label>),
Loop(P<Block>, Option<Label>, LoopSource),
Match(P<Expr>, HirVec<Arm>, MatchSource),
Closure(CaptureClause, P<FnDecl>, BodyId, Span, Option<GeneratorMovability>),
Block(P<Block>, Option<Label>),
Assign(P<Expr>, P<Expr>),
AssignOp(BinOp, P<Expr>, P<Expr>),
Field(P<Expr>, Ident),
Index(P<Expr>, P<Expr>),
Path(QPath),
AddrOf(Mutability, P<Expr>),
Break(Destination, Option<P<Expr>>),
Continue(Destination),
Ret(Option<P<Expr>>),
InlineAsm(P<InlineAsm>, HirVec<Expr>, HirVec<Expr>),
Struct(QPath, HirVec<Field>, Option<P<Expr>>),
Repeat(P<Expr>, AnonConst),
Yield(P<Expr>),
}🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Variants
Box(P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A box x expression.
Array(HirVec<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An array ([a, b, c, d])
Call(P<Expr>, HirVec<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A function call
The first field resolves to the function itself (usually an ExprKind::Path),
and the second field is the list of arguments.
This also represents calling the constructor of
tuple-like ADTs such as tuple structs and enum variants.
MethodCall(PathSegment, Span, HirVec<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A method call (x.foo::<'static, Bar, Baz>(a, b, c, d))
The PathSegment/Span represent the method name and its generic arguments
(within the angle brackets).
The first element of the vector of Exprs is the expression that evaluates
to the object on which the method is being called on (the receiver),
and the remaining elements are the rest of the arguments.
Thus, x.foo::<Bar, Baz>(a, b, c, d) is represented as
ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d]).
Tup(HirVec<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A tuple ((a, b, c ,d))
Binary(BinOp, P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A binary operation (For example: a + b, a * b)
Unary(UnOp, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A unary operation (For example: !x, *x)
Lit(P<Lit>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A literal (For example: 1, "foo")
Cast(P<Expr>, P<Ty>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A cast (foo as f64)
Type(P<Expr>, P<Ty>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
If(P<Expr>, P<Expr>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An if block, with an optional else block
if expr { expr } else { expr }
While(P<Expr>, P<Block>, Option<Label>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A while loop, with an optional label
'label: while expr { block }
Loop(P<Block>, Option<Label>, LoopSource)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Conditionless loop (can be exited with break, continue, or return)
'label: loop { block }
Match(P<Expr>, HirVec<Arm>, MatchSource)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A match block, with a source that indicates whether or not it is
the result of a desugaring, and if so, which kind.
Closure(CaptureClause, P<FnDecl>, BodyId, Span, Option<GeneratorMovability>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A closure (for example, move |a, b, c| {a + b + c}).
The final span is the span of the argument block |...|
This may also be a generator literal, indicated by the final boolean, in that case there is an GeneratorClause.
Block(P<Block>, Option<Label>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A block ('label: { ... })
Assign(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An assignment (a = foo())
AssignOp(BinOp, P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An assignment with an operator
For example, a += 1.
Field(P<Expr>, Ident)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Access of a named (obj.foo) or unnamed (obj.0) struct or tuple field
Index(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An indexing operation (foo[2])
Path(QPath)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Path to a definition, possibly containing lifetime or type parameters.
AddrOf(Mutability, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A referencing operation (&a or &mut a)
Break(Destination, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A break, with an optional label to break
Continue(Destination)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A continue, with an optional label
Ret(Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A return, with an optional value to be returned
InlineAsm(P<InlineAsm>, HirVec<Expr>, HirVec<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Inline assembly (from asm!), with its outputs and inputs.
Struct(QPath, HirVec<Field>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A struct or struct-like variant literal expression.
For example, Foo {x: 1, y: 2}, or
Foo {x: 1, .. base}, where base is the Option<Expr>.
Repeat(P<Expr>, AnonConst)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An array literal constructed from one repeated element.
For example, [1; 5]. The first expression is the element
to be repeated; the second is the number of times to repeat it.
Yield(P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A suspension point for generators. This is yield <expr> in Rust.
Trait Implementations
impl Clone for ExprKind[src]
impl Clone for ExprKindfn clone(&self) -> ExprKind[src]
fn clone(&self) -> ExprKindReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Encodable for ExprKind[src]
impl Encodable for ExprKindfn encode<__S: Encoder>(&self, s: &mut __S) -> Result<(), __S::Error>[src]
fn encode<__S: Encoder>(&self, s: &mut __S) -> Result<(), __S::Error>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Decodable for ExprKind[src]
impl Decodable for ExprKindfn decode<__D: Decoder>(d: &mut __D) -> Result<ExprKind, __D::Error>[src]
fn decode<__D: Decoder>(d: &mut __D) -> Result<ExprKind, __D::Error>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Debug for ExprKind[src]
impl Debug for ExprKindfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ExprKind[src]
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ExprKindfn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'a>,
__hasher: &mut StableHasher<W>
)[src]
fn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'a>,
__hasher: &mut StableHasher<W>
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?