@@ -3,7 +3,7 @@ use syntax::ast;
3
3
use syntax_pos:: Span ;
4
4
5
5
use rustc:: ty:: { self , TyCtxt } ;
6
- use rustc:: hir;
6
+ use rustc:: hir:: def_id :: DefId ;
7
7
use rustc:: mir:: { self , Mir , Location } ;
8
8
use rustc_data_structures:: bit_set:: BitSet ;
9
9
use crate :: transform:: { MirPass , MirSource } ;
@@ -27,7 +27,6 @@ impl MirPass for SanityCheck {
27
27
fn run_pass < ' a , ' tcx > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
28
28
src : MirSource < ' tcx > , mir : & mut Mir < ' tcx > ) {
29
29
let def_id = src. def_id ( ) ;
30
- let id = tcx. hir ( ) . as_local_hir_id ( def_id) . unwrap ( ) ;
31
30
if !tcx. has_attr ( def_id, "rustc_mir" ) {
32
31
debug ! ( "skipping rustc_peek::SanityCheck on {}" , tcx. def_path_str( def_id) ) ;
33
32
return ;
@@ -41,26 +40,26 @@ impl MirPass for SanityCheck {
41
40
let mdpe = MoveDataParamEnv { move_data : move_data, param_env : param_env } ;
42
41
let dead_unwinds = BitSet :: new_empty ( mir. basic_blocks ( ) . len ( ) ) ;
43
42
let flow_inits =
44
- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
43
+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
45
44
MaybeInitializedPlaces :: new ( tcx, mir, & mdpe) ,
46
45
|bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
47
46
let flow_uninits =
48
- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
47
+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
49
48
MaybeUninitializedPlaces :: new ( tcx, mir, & mdpe) ,
50
49
|bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
51
50
let flow_def_inits =
52
- do_dataflow ( tcx, mir, id , & attributes, & dead_unwinds,
51
+ do_dataflow ( tcx, mir, def_id , & attributes, & dead_unwinds,
53
52
DefinitelyInitializedPlaces :: new ( tcx, mir, & mdpe) ,
54
53
|bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
55
54
56
55
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) ;
58
57
}
59
58
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) ;
61
60
}
62
61
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) ;
64
63
}
65
64
if has_rustc_mir_with ( & attributes, "stop_after_dataflow" ) . is_some ( ) {
66
65
tcx. sess . fatal ( "stop_after_dataflow ended compilation" ) ;
@@ -86,12 +85,12 @@ impl MirPass for SanityCheck {
86
85
/// errors are not intended to be used for unit tests.)
87
86
pub fn sanity_check_via_rustc_peek < ' a , ' tcx , O > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
88
87
mir : & Mir < ' tcx > ,
89
- id : hir :: HirId ,
88
+ def_id : DefId ,
90
89
_attributes : & [ ast:: Attribute ] ,
91
90
results : & DataflowResults < ' tcx , O > )
92
91
where O : BitDenotation < ' tcx , Idx =MovePathIndex > + HasMoveData < ' tcx >
93
92
{
94
- debug ! ( "sanity_check_via_rustc_peek id : {:?}" , id ) ;
93
+ debug ! ( "sanity_check_via_rustc_peek def_id : {:?}" , def_id ) ;
95
94
// FIXME: this is not DRY. Figure out way to abstract this and
96
95
// `dataflow::build_sets`. (But note it is doing non-standard
97
96
// stuff, so such generalization may not be realistic.)
0 commit comments