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>,
}

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>

type of this expression

temp_lifetime: Option<Scope>

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

span: Span

span of the expression in the source

kind: ExprKind<'thir, 'tcx>

kind of expression

Trait Implementations

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

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

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]

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

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

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

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

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

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.

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.