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

pub(crate) struct Expr<'tcx> {
    pub(crate) ty: Ty<'tcx>,
    pub(crate) temp_lifetime: Option<Scope>,
    pub(crate) span: Span,
    pub(crate) kind: ExprKind<'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 ExprRef<'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<'tcx>

kind of expression

Trait Implementations

impl<'tcx> Clone for Expr<'tcx>[src]

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

impl<'tcx> EvalInto<'tcx> for Expr<'tcx>[src]

impl<'tcx> Mirror<'tcx> for Expr<'tcx>[src]

type Output = Expr<'tcx>

impl<'tcx> ToRef for Expr<'tcx>[src]

type Output = ExprRef<'tcx>

Auto Trait Implementations

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

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

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

impl<'tcx> Unpin for Expr<'tcx>

impl<'tcx> !UnwindSafe for Expr<'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> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

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.