@@ -3,7 +3,7 @@ use syntax::ast;
33use syntax_pos:: Span ;
44
55use rustc:: ty:: { self , TyCtxt } ;
6- use rustc:: hir;
6+ use rustc:: hir:: def_id :: DefId ;
77use rustc:: mir:: { self , Mir , Location } ;
88use rustc_data_structures:: bit_set:: BitSet ;
99use crate :: transform:: { MirPass , MirSource } ;
@@ -27,7 +27,6 @@ impl MirPass for SanityCheck {
2727 fn run_pass < ' a , ' tcx > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
2828 src : MirSource < ' tcx > , mir : & mut Mir < ' tcx > ) {
2929 let def_id = src. def_id ( ) ;
30- let id = tcx. hir ( ) . as_local_hir_id ( def_id) . unwrap ( ) ;
3130 if !tcx. has_attr ( def_id, "rustc_mir" ) {
3231 debug ! ( "skipping rustc_peek::SanityCheck on {}" , tcx. def_path_str( def_id) ) ;
3332 return ;
@@ -41,26 +40,26 @@ impl MirPass for SanityCheck {
4140 let mdpe = MoveDataParamEnv { move_data : move_data, param_env : param_env } ;
4241 let dead_unwinds = BitSet :: new_empty ( mir. basic_blocks ( ) . len ( ) ) ;
4342 let flow_inits =
44- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
43+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
4544 MaybeInitializedPlaces :: new ( tcx, mir, & mdpe) ,
4645 |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
4746 let flow_uninits =
48- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
47+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
4948 MaybeUninitializedPlaces :: new ( tcx, mir, & mdpe) ,
5049 |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
5150 let flow_def_inits =
52- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
51+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
5352 DefinitelyInitializedPlaces :: new ( tcx, mir, & mdpe) ,
5453 |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
5554
5655 if has_rustc_mir_with ( & attributes, "rustc_peek_maybe_init" ) . is_some ( ) {
57- sanity_check_via_rustc_peek ( tcx, mir, id , & attributes, & flow_inits) ;
56+ sanity_check_via_rustc_peek ( tcx, mir, def_id , & attributes, & flow_inits) ;
5857 }
5958 if has_rustc_mir_with ( & attributes, "rustc_peek_maybe_uninit" ) . is_some ( ) {
60- sanity_check_via_rustc_peek ( tcx, mir, id , & attributes, & flow_uninits) ;
59+ sanity_check_via_rustc_peek ( tcx, mir, def_id , & attributes, & flow_uninits) ;
6160 }
6261 if has_rustc_mir_with ( & attributes, "rustc_peek_definite_init" ) . is_some ( ) {
63- sanity_check_via_rustc_peek ( tcx, mir, id , & attributes, & flow_def_inits) ;
62+ sanity_check_via_rustc_peek ( tcx, mir, def_id , & attributes, & flow_def_inits) ;
6463 }
6564 if has_rustc_mir_with ( & attributes, "stop_after_dataflow" ) . is_some ( ) {
6665 tcx. sess . fatal ( "stop_after_dataflow ended compilation" ) ;
@@ -86,12 +85,12 @@ impl MirPass for SanityCheck {
8685/// errors are not intended to be used for unit tests.)
8786pub fn sanity_check_via_rustc_peek < ' a , ' tcx , O > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
8887 mir : & Mir < ' tcx > ,
89- id : hir :: HirId ,
88+ def_id : DefId ,
9089 _attributes : & [ ast:: Attribute ] ,
9190 results : & DataflowResults < ' tcx , O > )
9291 where O : BitDenotation < ' tcx , Idx =MovePathIndex > + HasMoveData < ' tcx >
9392{
94- debug ! ( "sanity_check_via_rustc_peek id : {:?}" , id ) ;
93+ debug ! ( "sanity_check_via_rustc_peek def_id : {:?}" , def_id ) ;
9594 // FIXME: this is not DRY. Figure out way to abstract this and
9695 // `dataflow::build_sets`. (But note it is doing non-standard
9796 // stuff, so such generalization may not be realistic.)
0 commit comments