Struct rustc_mir_build::thir::Expr[−][src]

pub struct Expr<'thir, 'tcx> {
    pub ty: Ty<'tcx>,
    pub temp_lifetime: Option<Scope>,
    pub span: Span,
    pub kind: ExprKind<'thir, 'tcx>,
}
Expand description

The Thir trait implementor lowers their expressions (&'tcx H::Expr) into instances of this Expr enum. This lowering can be done basically as lazily or as eagerly as desired: every recursive reference to an expression in this enum is an &'thir Expr<'thir, 'tcx>, which may in turn be another instance of this enum (boxed), or else an unlowered &'tcx H::Expr. Note that instances of Expr are very short-lived. They are created by Thir::to_expr, analyzed and converted into MIR, and then discarded.

If you compare Expr to the full compiler AST, you will see it is a good bit simpler. In fact, a number of the more straight-forward MIR simplifications are already done in the impl of Thir. For example, method calls and overloaded operators are absent: they are expected to be converted into Expr::Call instances.

Fields

ty: Ty<'tcx>
Expand description

type of this expression

temp_lifetime: Option<Scope>
Expand description

lifetime of this expression if it should be spilled into a temporary; should be None only if in a constant context

span: Span
Expand description

span of the expression in the source

kind: ExprKind<'thir, 'tcx>
Expand description

kind of expression

Trait Implementations

impl<'thir, 'tcx> ArenaAllocatable<'thir, 'tcx, Expr<'thir, 'tcx>> for Expr<'thir, 'tcx>[src]

fn allocate_on(self, arena: &'thir Arena<'thir, 'tcx>) -> &'thir mut Self[src]

fn allocate_from_iter(
    arena: &'thir Arena<'thir, 'tcx>,
    iter: impl IntoIterator<Item = Self>
) -> &'thir mut [Self]
[src]

impl<'thir, 'tcx> Debug for Expr<'thir, 'tcx>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'thir, 'tcx> !RefUnwindSafe for Expr<'thir, 'tcx>

impl<'thir, 'tcx> !Send for Expr<'thir, 'tcx>

impl<'thir, 'tcx> !Sync for Expr<'thir, 'tcx>

impl<'thir, 'tcx> Unpin for Expr<'thir, 'tcx> where
    'tcx: 'thir, 

impl<'thir, 'tcx> !UnwindSafe for Expr<'thir, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]