fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> Steal<Body<'_>> {
    let def_id = def_id.expect_local();

    // Unsafety check uses the raw mir, so make sure it is run.
    let _ = tcx.unsafety_check_result(def_id);

    let mut body = tcx.mir_built(def_id).steal();

    util::dump_mir(tcx, None, "mir_map", &0, MirSource::item(def_id.to_def_id()), &body, |_, _| {
        Ok(())
    });

    run_passes(
        tcx,
        &mut body,
        InstanceDef::Item(def_id.to_def_id()),
        None,
        MirPhase::Const,
        &[&[
            // MIR-level lints.
            &check_packed_ref::CheckPackedRef,
            // What we need to do constant evaluation.
            &simplify::SimplifyCfg::new("initial"),
            &rustc_peek::SanityCheck,
        ]],
    );
    tcx.alloc_steal_mir(body)
}
/// Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
Make MIR ready for const evaluation . This is run on all MIR not just on consts!
fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> Steal<Body<'_>> {
    let def_id = def_id.expect_local();
    // Unsafety check uses the raw mir, so make sure it is run.
    let _ = tcx.unsafety_check_result(def_id);
    let mut body = tcx.mir_built(def_id).steal();
    util::dump_mir(tcx, None, "mir_map", &0, MirSource::item(def_id.to_def_id()), &body, |_, _| {
        Ok(())
    });
    run_passes(
        tcx,
        &mut body,
        InstanceDef::Item(def_id.to_def_id()),
        None,
        MirPhase::Const,
        &[&[
            // MIR-level lints.
            &check_packed_ref::CheckPackedRef,
            // What we need to do constant evaluation.
            &simplify::SimplifyCfg::new("initial"),
            &rustc_peek::SanityCheck,
        ]],
    );
    tcx.alloc_steal_mir(body)
}
fn mir_const ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> Steal < Body < ' _ > > { let def_id = def_id . expect_local ( ) ; // Unsafety check uses the raw mir, so make sure it is run. let _ = tcx . unsafety_check_result ( def_id ) ; let mut body = tcx . mir_built ( def_id ) . steal ( ) ; util :: dump_mir ( tcx , None , " " , & 0 , MirSource :: item ( def_id . to_def_id ( ) ) , & body , | _ , _ | { Ok ( ( ) ) } ) ; run_passes ( tcx , & mut body , InstanceDef :: Item ( def_id . to_def_id ( ) ) , None , MirPhase :: Const , & [ & [ // MIR-level lints. & check_packed_ref :: CheckPackedRef , // What we need to do constant evaluation. & simplify :: SimplifyCfg :: new ( " " ) , & rustc_peek :: SanityCheck , ] ] , ) ; tcx . alloc_steal_mir ( body ) }
Make MIR ready for const evaluation.
Make MIR ready for const evaluation .
tcx
TyCtxt<'_>
def_id
DefId
tcx
TyCtxt<'_>
def_id
DefId