[−][src]Enum rustc_ap_rustc_ast::ast::ExprKind
Variants
A box x
expression.
An array ([a, b, c, d]
)
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>>)
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])
.
A tuple (e.g., (a, b, c, d)
).
A binary operation (e.g., a + b
, a * b
).
A unary operation (e.g., !x
, *x
).
Lit(Lit)
A literal (e.g., 1
, "foo"
).
A cast (e.g., foo as f64
).
A type ascription (e.g., 42: usize
).
A let pat = expr
expression that is only semantically allowed in the condition
of if
/ while
expressions. (e.g., if let 0 = x { .. }
).
An if
block, with an optional else
block.
if expr { block } else { expr }
A while loop, with an optional label.
'label: while expr { block }
A for
loop, with an optional label.
'label: for pat in expr { block }
This is desugared to a combination of loop
and match
expressions.
Conditionless loop (can be exited with break
, continue
, or return
).
'label: loop { block }
A match
block.
A closure (e.g., move |a, b, c| a + b + c
).
The final span is the span of the argument block |...|
.
A block ('label: { ... }
).
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.
An await expression (my_future.await
).
A try block (try { ... }
).
An assignment (a = foo()
).
The Span
argument is the span of the =
token.
An assignment with an operator.
E.g., a += 1
.
Access of a named (e.g., obj.foo
) or unnamed (e.g., obj.0
) struct field.
An indexing operation (e.g., foo[2]
).
A range (e.g., 1..2
, 1..
, ..2
, 1..=2
, ..=2
).
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>)
A referencing operation (&a
, &mut a
, &raw const a
or &raw mut a
).
A break
, with an optional label to break, and an optional expression.
A continue
, with an optional label.
A return
, with an optional value to be returned.
LlvmInlineAsm(P<LlvmInlineAsm>)
Output of the llvm_asm!()
macro.
MacCall(MacCall)
A macro invocation; pre-expansion.
A struct literal expression.
E.g., Foo {x: 1, y: 2}
, or Foo {x: 1, .. base}
,
where base
is the Option<Expr>
.
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.
No-op: used solely so we can pretty-print faithfully.
A try expression (expr?
).
A yield
, with an optional value to be yielded.
Placeholder for an expression that wasn't syntactically well formed in some way.
Trait Implementations
impl Clone for ExprKind
[src]
impl Debug for ExprKind
[src]
impl Decodable for ExprKind
[src]
impl Encodable for ExprKind
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable,
[src]
T: UseSpecializedDecodable,
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
[src]
T: UseSpecializedEncodable + ?Sized,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,