Enum rustc_typeck::hir::Expr_ [] [src]

pub enum Expr_ {
    ExprBox(P<Expr>),
    ExprVec(P<[P<Expr>]>),
    ExprCall(P<Expr>, P<[P<Expr>]>),
    ExprMethodCall(Spanned<Name>, P<[P<Ty>]>, P<[P<Expr>]>),
    ExprTup(P<[P<Expr>]>),
    ExprBinary(Spanned<BinOp_>, P<Expr>, P<Expr>),
    ExprUnary(UnOpP<Expr>),
    ExprLit(P<Spanned<LitKind>>),
    ExprCast(P<Expr>, P<Ty>),
    ExprType(P<Expr>, P<Ty>),
    ExprIf(P<Expr>, P<Block>, Option<P<Expr>>),
    ExprWhile(P<Expr>, P<Block>, Option<Name>),
    ExprLoop(P<Block>, Option<Name>),
    ExprMatch(P<Expr>, P<[Arm]>, MatchSource),
    ExprClosure(CaptureClauseP<FnDecl>, P<Block>, Span),
    ExprBlock(P<Block>),
    ExprAssign(P<Expr>, P<Expr>),
    ExprAssignOp(Spanned<BinOp_>, P<Expr>, P<Expr>),
    ExprField(P<Expr>, Spanned<Name>),
    ExprTupField(P<Expr>, Spanned<usize>),
    ExprIndex(P<Expr>, P<Expr>),
    ExprPath(Option<QSelf>, Path),
    ExprAddrOf(MutabilityP<Expr>),
    ExprBreak(Option<Spanned<Name>>),
    ExprAgain(Option<Spanned<Name>>),
    ExprRet(Option<P<Expr>>),
    ExprInlineAsm(InlineAsmVec<P<Expr>>, Vec<P<Expr>>),
    ExprStruct(PathP<[Field]>, Option<P<Expr>>),
    ExprRepeat(P<Expr>, P<Expr>),
}
Unstable (rustc_private)

Variants

ExprBox(P<Expr>)
Unstable (rustc_private)

A box x expression.

ExprVec(P<[P<Expr>]>)
Unstable (rustc_private)

An array ([a, b, c, d])

ExprCall(P<Expr>, P<[P<Expr>]>)
Unstable (rustc_private)

A function call

The first field resolves to the function itself, and the second field is the list of arguments

ExprMethodCall(Spanned<Name>, P<[P<Ty>]>, P<[P<Expr>]>)
Unstable (rustc_private)

A method call (x.foo::<Bar, Baz>(a, b, c, d))

The Spanned<Name> is the identifier for the method name. The vector of Tys are the ascripted type parameters for the method (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 ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d]).

ExprTup(P<[P<Expr>]>)
Unstable (rustc_private)

A tuple ((a, b, c ,d))

ExprBinary(Spanned<BinOp_>, P<Expr>, P<Expr>)
Unstable (rustc_private)

A binary operation (For example: a + b, a * b)

ExprUnary(UnOpP<Expr>)
Unstable (rustc_private)

A unary operation (For example: !x, *x)

ExprLit(P<Spanned<LitKind>>)
Unstable (rustc_private)

A literal (For example: 1, "foo")

ExprCast(P<Expr>, P<Ty>)
Unstable (rustc_private)

A cast (foo as f64)

ExprType(P<Expr>, P<Ty>)
Unstable (rustc_private)
ExprIf(P<Expr>, P<Block>, Option<P<Expr>>)
Unstable (rustc_private)

An if block, with an optional else block

if expr { block } else { expr }

ExprWhile(P<Expr>, P<Block>, Option<Name>)
Unstable (rustc_private)

A while loop, with an optional label

'label: while expr { block }

ExprLoop(P<Block>, Option<Name>)
Unstable (rustc_private)

Conditionless loop (can be exited with break, continue, or return)

'label: loop { block }

ExprMatch(P<Expr>, P<[Arm]>, MatchSource)
Unstable (rustc_private)

A match block, with a source that indicates whether or not it is the result of a desugaring, and if so, which kind.

ExprClosure(CaptureClauseP<FnDecl>, P<Block>, Span)
Unstable (rustc_private)

A closure (for example, move |a, b, c| {a + b + c}).

The final span is the span of the argument block |...|

ExprBlock(P<Block>)
Unstable (rustc_private)

A block ({ ... })

ExprAssign(P<Expr>, P<Expr>)
Unstable (rustc_private)

An assignment (a = foo())

ExprAssignOp(Spanned<BinOp_>, P<Expr>, P<Expr>)
Unstable (rustc_private)

An assignment with an operator

For example, a += 1.

ExprField(P<Expr>, Spanned<Name>)
Unstable (rustc_private)

Access of a named struct field (obj.foo)

ExprTupField(P<Expr>, Spanned<usize>)
Unstable (rustc_private)

Access of an unnamed field of a struct or tuple-struct

For example, foo.0.

ExprIndex(P<Expr>, P<Expr>)
Unstable (rustc_private)

An indexing operation (foo[2])

ExprPath(Option<QSelf>, Path)
Unstable (rustc_private)

Variable reference, possibly containing :: and/or type parameters, e.g. foo::bar::.

Optionally "qualified", e.g. <HirVec<T> as SomeTrait>::SomeType.

ExprAddrOf(MutabilityP<Expr>)
Unstable (rustc_private)

A referencing operation (&a or &mut a)

ExprBreak(Option<Spanned<Name>>)
Unstable (rustc_private)

A break, with an optional label to break

ExprAgain(Option<Spanned<Name>>)
Unstable (rustc_private)

A continue, with an optional label

ExprRet(Option<P<Expr>>)
Unstable (rustc_private)

A return, with an optional value to be returned

ExprInlineAsm(InlineAsmVec<P<Expr>>, Vec<P<Expr>>)
Unstable (rustc_private)

Inline assembly (from asm!), with its outputs and inputs.

ExprStruct(PathP<[Field]>, Option<P<Expr>>)
Unstable (rustc_private)

A struct literal expression.

For example, Foo {x: 1, y: 2}, or Foo {x: 1, .. base}, where base is the Option<Expr>.

ExprRepeat(P<Expr>, P<Expr>)
Unstable (rustc_private)

A vector 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.

Trait Implementations

Derived Implementations

impl Debug for Expr_

fn fmt(&self, __arg_0: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.

impl Hash for Expr_

fn hash<__H>(&self, __arg_0: &mut __H) where __H: Hasher

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Decodable for Expr_

fn decode<__D>(__arg_0: &mut __D) -> Result<Expr_, __D::Error> where __D: Decoder

impl Encodable for Expr_

fn encode<__S>(&self, __arg_0: &mut __S) -> Result<(), __S::Error> where __S: Encoder

impl Eq for Expr_

impl PartialEq<Expr_> for Expr_

fn eq(&self, __arg_0: &Expr_) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Expr_) -> bool

This method tests for !=.

impl Clone for Expr_

fn clone(&self) -> Expr_

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more