Use LocalDefId
in mir_built
query
This commit is contained in:
parent
abd31ad6e8
commit
f2f0478de7
3 changed files with 10 additions and 6 deletions
|
@ -170,7 +170,7 @@ rustc_queries! {
|
|||
|
||||
/// Fetch the MIR for a given `DefId` right after it's built - this includes
|
||||
/// unreachable code.
|
||||
query mir_built(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {
|
||||
query mir_built(_: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
|
||||
desc { "building MIR for" }
|
||||
}
|
||||
|
||||
|
|
|
@ -211,17 +211,21 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> ConstQualifs {
|
|||
}
|
||||
|
||||
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.expect_local());
|
||||
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), &body, |_, _| Ok(()));
|
||||
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),
|
||||
InstanceDef::Item(def_id.to_def_id()),
|
||||
None,
|
||||
MirPhase::Const,
|
||||
&[&[
|
||||
|
|
|
@ -21,8 +21,8 @@ use rustc_target::spec::PanicStrategy;
|
|||
|
||||
use super::lints;
|
||||
|
||||
crate fn mir_built(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::steal::Steal<Body<'_>> {
|
||||
tcx.alloc_steal_mir(mir_build(tcx, def_id.expect_local()))
|
||||
crate fn mir_built(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &ty::steal::Steal<Body<'_>> {
|
||||
tcx.alloc_steal_mir(mir_build(tcx, def_id))
|
||||
}
|
||||
|
||||
/// Construct the MIR for a given `DefId`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue