Skip to content

Commit 9014df5

Browse files
validator: print MIR instance on failure
1 parent 99d30da commit 9014df5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/librustc_mir/transform/validate.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_middle::{
99
},
1010
ty::{self, ParamEnv, TyCtxt},
1111
};
12-
use rustc_span::def_id::DefId;
1312

1413
#[derive(Copy, Clone, Debug)]
1514
enum EdgeKind {
@@ -24,15 +23,14 @@ pub struct Validator {
2423

2524
impl<'tcx> MirPass<'tcx> for Validator {
2625
fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
27-
let def_id = source.def_id();
28-
let param_env = tcx.param_env(def_id);
29-
TypeChecker { when: &self.when, def_id, body, tcx, param_env }.visit_body(body);
26+
let param_env = tcx.param_env(source.def_id());
27+
TypeChecker { when: &self.when, source, body, tcx, param_env }.visit_body(body);
3028
}
3129
}
3230

3331
struct TypeChecker<'a, 'tcx> {
3432
when: &'a str,
35-
def_id: DefId,
33+
source: MirSource<'tcx>,
3634
body: &'a Body<'tcx>,
3735
tcx: TyCtxt<'tcx>,
3836
param_env: ParamEnv<'tcx>,
@@ -47,7 +45,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
4745
span,
4846
&format!(
4947
"broken MIR in {:?} ({}) at {:?}:\n{}",
50-
self.def_id,
48+
self.source.instance,
5149
self.when,
5250
location,
5351
msg.as_ref()

0 commit comments

Comments
 (0)