[−][src]Trait rustc_mir_build::thir::Mirror

pub(crate) trait Mirror<'tcx> {
    type Output;
    fn make_mirror(self, cx: &mut Cx<'_, 'tcx>) -> Self::Output;
}

"Mirroring" is the process of converting from a HIR type into one of the THIR types defined in this file. This is basically a "on the fly" desugaring step that hides a lot of the messiness in the tcx. For example, the mirror of a &'tcx hir::Expr is an Expr<'tcx>.

Mirroring is gradual: when you mirror an outer expression like e1 + e2, the references to the inner expressions e1 and e2 are ExprRef<'tcx> instances, and they may or may not be eagerly mirrored. This allows a single AST node from the compiler to expand into one or more Thir nodes, which lets the Thir nodes be simpler.

Associated Types

type Output

Loading content...

Required methods

fn make_mirror(self, cx: &mut Cx<'_, 'tcx>) -> Self::Output

Loading content...

Implementations on Foreign Types

impl<'tcx> Mirror<'tcx> for &'tcx Block<'tcx>[src]

type Output = Block<'tcx>

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

type Output = Expr<'tcx>

Loading content...

Implementors

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

type Output = Expr<'tcx>

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

type Output = Stmt<'tcx>

impl<'tcx> Mirror<'tcx> for rustc_mir_build::thir::Block<'tcx>[src]

type Output = Block<'tcx>

impl<'tcx> Mirror<'tcx> for rustc_mir_build::thir::Expr<'tcx>[src]

type Output = Expr<'tcx>

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

type Output = Stmt<'tcx>

Loading content...