Enum rustc_ap_rustc_ast::ast::ExprKind [−][src]
pub enum ExprKind {}Show variants
Box(P<Expr>), Array(Vec<P<Expr>>), ConstBlock(AnonConst), Call(P<Expr>, Vec<P<Expr>>), MethodCall(PathSegment, Vec<P<Expr>>, Span), Tup(Vec<P<Expr>>), Binary(BinOp, P<Expr>, P<Expr>), Unary(UnOp, P<Expr>), Lit(Lit), Cast(P<Expr>, P<Ty>), Type(P<Expr>, P<Ty>), Let(P<Pat>, P<Expr>), If(P<Expr>, P<Block>, Option<P<Expr>>), While(P<Expr>, P<Block>, Option<Label>), ForLoop(P<Pat>, P<Expr>, P<Block>, Option<Label>), Loop(P<Block>, Option<Label>), Match(P<Expr>, Vec<Arm>), Closure(CaptureBy, Async, Movability, P<FnDecl>, P<Expr>, Span), Block(P<Block>, Option<Label>), Async(CaptureBy, NodeId, P<Block>), Await(P<Expr>), TryBlock(P<Block>), Assign(P<Expr>, P<Expr>, Span), AssignOp(BinOp, P<Expr>, P<Expr>), Field(P<Expr>, Ident), Index(P<Expr>, P<Expr>), Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits), Underscore, Path(Option<QSelf>, Path), AddrOf(BorrowKind, Mutability, P<Expr>), Break(Option<Label>, Option<P<Expr>>), Continue(Option<Label>), Ret(Option<P<Expr>>), InlineAsm(P<InlineAsm>), LlvmInlineAsm(P<LlvmInlineAsm>), MacCall(MacCall), Struct(P<StructExpr>), Repeat(P<Expr>, AnonConst), Paren(P<Expr>), Try(P<Expr>), Yield(Option<P<Expr>>), Err,
Variants
Expand description
A box x
expression.
Expand description
An array ([a, b, c, d]
)
ConstBlock(AnonConst)
Expand description
Allow anonymous constants from an inline const
block
Expand description
A function call
The first field resolves to the function itself, 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, Vec<P<Expr>>, Span)
Expand description
A method call (x.foo::<'static, Bar, Baz>(a, b, c, d)
)
The PathSegment
represents the method name and its generic arguments
(within the angle brackets).
The first element of the vector of an Expr
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])
.
This Span
is the span of the function, without the dot and receiver
(e.g. foo(a, b)
in x.foo(a, b)
Expand description
A tuple (e.g., (a, b, c, d)
).
Expand description
A binary operation (e.g., a + b
, a * b
).
Expand description
A unary operation (e.g., !x
, *x
).
Lit(Lit)
Expand description
A literal (e.g., 1
, "foo"
).
Expand description
A cast (e.g., foo as f64
).
Expand description
A type ascription (e.g., 42: usize
).
Expand description
A let pat = expr
expression that is only semantically allowed in the condition
of if
/ while
expressions. (e.g., if let 0 = x { .. }
).
Expand description
An if
block, with an optional else
block.
if expr { block } else { expr }
Expand description
A while loop, with an optional label.
'label: while expr { block }
Expand description
A for
loop, with an optional label.
'label: for pat in expr { block }
This is desugared to a combination of loop
and match
expressions.
Expand description
Conditionless loop (can be exited with break
, continue
, or return
).
'label: loop { block }
Expand description
A match
block.
Expand description
A closure (e.g., move |a, b, c| a + b + c
).
The final span is the span of the argument block |...|
.
Expand description
A block ('label: { ... }
).
Expand description
An async block (async move { ... }
).
The NodeId
is the NodeId
for the closure that results from
desugaring an async block, just like the NodeId field in the
Async::Yes
variant. This is necessary in order to create a def for the
closure which can be used as a parent of any child defs. Defs
created during lowering cannot be made the parent of any other
preexisting defs.
Expand description
An await expression (my_future.await
).
Expand description
A try block (try { ... }
).
Expand description
An assignment (a = foo()
).
The Span
argument is the span of the =
token.
Expand description
An assignment with an operator.
E.g., a += 1
.
Expand description
Access of a named (e.g., obj.foo
) or unnamed (e.g., obj.0
) struct field.
Expand description
An indexing operation (e.g., foo[2]
).
Expand description
A range (e.g., 1..2
, 1..
, ..2
, 1..=2
, ..=2
; and ..
in destructuring assignment).
Expand description
An underscore, used in destructuring assignment to ignore a value.
Expand description
Variable reference, possibly containing ::
and/or type
parameters (e.g., foo::bar::<baz>
).
Optionally “qualified” (e.g., <Vec<T> as SomeTrait>::SomeType
).
AddrOf(BorrowKind, Mutability, P<Expr>)
Expand description
A referencing operation (&a
, &mut a
, &raw const a
or &raw mut a
).
Expand description
A break
, with an optional label to break, and an optional expression.
Expand description
A continue
, with an optional label.
Expand description
A return
, with an optional value to be returned.
Expand description
Output of the asm!()
macro.
LlvmInlineAsm(P<LlvmInlineAsm>)
Expand description
Output of the llvm_asm!()
macro.
MacCall(MacCall)
Expand description
A macro invocation; pre-expansion.
Struct(P<StructExpr>)
Expand description
A struct literal expression.
E.g., Foo {x: 1, y: 2}
, or Foo {x: 1, .. rest}
.
Expand description
An array literal constructed from one repeated element.
E.g., [1; 5]
. The expression is the element to be
repeated; the constant is the number of times to repeat it.
Expand description
No-op: used solely so we can pretty-print faithfully.
Expand description
A try expression (expr?
).
Expand description
A yield
, with an optional value to be yielded.
Expand description
Placeholder for an expression that wasn’t syntactically well formed in some way.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ExprKind
impl !Send for ExprKind
impl !Sync for ExprKind
impl Unpin for ExprKind
impl !UnwindSafe for ExprKind
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,