Struct rustc_hir::hir::Expr

source ·
pub struct Expr<'hir> {
    pub hir_id: HirId,
    pub kind: ExprKind<'hir>,
    pub span: Span,
Expand description

An expression.


§hir_id: HirId§kind: ExprKind<'hir>§span: Span


Whether this looks like a place expr, without checking for deref adjustments. This will return true in some potentially surprising cases such as CONSTANT.field.

Whether this is a place expression.

allow_projections_from should return true if indexing a field or index expression based on the given expression should be considered a place expression.

If Self.kind is ExprKind::DropTemps(expr), drill down until we get a non-DropTemps Expr. This is used in suggestions to ignore this ExprKind as it is semantically silent, only signaling the ownership system. By doing this, suggestions that check the ExprKind of any given Expr for presentation don’t have to care about DropTemps beyond remembering to call this function before doing analysis on it.

To a first-order approximation, is this a pattern?

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.


Note: Most layout information is completely unstable and may even differ between compilations. 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: 64 bytes