Skip to content

Commit d9e286b

Browse files
committed
Use LocalDefId in mir_built query
1 parent afe4b1b commit d9e286b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/librustc_middle/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ rustc_queries! {
170170

171171
/// Fetch the MIR for a given `DefId` right after it's built - this includes
172172
/// unreachable code.
173-
query mir_built(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {
173+
query mir_built(_: LocalDefId) -> &'tcx Steal<mir::Body<'tcx>> {
174174
desc { "building MIR for" }
175175
}
176176

src/librustc_mir/transform/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,21 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> ConstQualifs {
209209
}
210210

211211
fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
212+
let def_id = def_id.expect_local();
213+
212214
// Unsafety check uses the raw mir, so make sure it is run
213-
let _ = tcx.unsafety_check_result(def_id.expect_local());
215+
let _ = tcx.unsafety_check_result(def_id);
214216

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

217-
util::dump_mir(tcx, None, "mir_map", &0, MirSource::item(def_id), &body, |_, _| Ok(()));
219+
util::dump_mir(tcx, None, "mir_map", &0, MirSource::item(def_id.to_def_id()), &body, |_, _| {
220+
Ok(())
221+
});
218222

219223
run_passes(
220224
tcx,
221225
&mut body,
222-
InstanceDef::Item(def_id),
226+
InstanceDef::Item(def_id.to_def_id()),
223227
None,
224228
MirPhase::Const,
225229
&[

src/librustc_mir_build/build/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use rustc_target::spec::PanicStrategy;
2121

2222
use super::lints;
2323

24-
crate fn mir_built(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::steal::Steal<Body<'_>> {
25-
tcx.alloc_steal_mir(mir_build(tcx, def_id.expect_local()))
24+
crate fn mir_built(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &ty::steal::Steal<Body<'_>> {
25+
tcx.alloc_steal_mir(mir_build(tcx, def_id))
2626
}
2727

2828
/// Construct the MIR for a given `DefId`.

0 commit comments

Comments
 (0)