@@ -9,24 +9,24 @@ use rustc::mir::{self, Body, Location, Local};
9
9
use rustc_index:: bit_set:: BitSet ;
10
10
use crate :: transform:: { MirPass , MirSource } ;
11
11
12
+ use crate :: dataflow:: generic:: { Analysis , Results , ResultsCursor } ;
12
13
use crate :: dataflow:: { do_dataflow, DebugFormatted } ;
13
14
use crate :: dataflow:: MoveDataParamEnv ;
14
- use crate :: dataflow:: BitDenotation ;
15
- use crate :: dataflow:: DataflowResults ;
16
- use crate :: dataflow:: DataflowResultsCursor ;
17
15
use crate :: dataflow:: {
18
16
DefinitelyInitializedPlaces , MaybeInitializedPlaces , MaybeUninitializedPlaces
19
17
} ;
20
18
use crate :: dataflow:: IndirectlyMutableLocals ;
21
19
use crate :: dataflow:: move_paths:: { MovePathIndex , LookupResult } ;
22
20
use crate :: dataflow:: move_paths:: { HasMoveData , MoveData } ;
23
21
24
- use crate :: dataflow:: has_rustc_mir_with;
25
22
26
23
pub struct SanityCheck ;
27
24
28
25
impl < ' tcx > MirPass < ' tcx > for SanityCheck {
26
+ #[ allow( unused) ]
29
27
fn run_pass ( & self , tcx : TyCtxt < ' tcx > , src : MirSource < ' tcx > , body : & mut Body < ' tcx > ) {
28
+ use crate :: dataflow:: has_rustc_mir_with;
29
+
30
30
let def_id = src. def_id ( ) ;
31
31
if !tcx. has_attr ( def_id, sym:: rustc_mir) {
32
32
debug ! ( "skipping rustc_peek::SanityCheck on {}" , tcx. def_path_str( def_id) ) ;
@@ -57,6 +57,8 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
57
57
IndirectlyMutableLocals :: new ( tcx, body, param_env) ,
58
58
|_, i| DebugFormatted :: new ( & i) ) ;
59
59
60
+ // FIXME: add these back as dataflow analyses are migrated
61
+ /*
60
62
if has_rustc_mir_with(&attributes, sym::rustc_peek_maybe_init).is_some() {
61
63
sanity_check_via_rustc_peek(tcx, body, def_id, &attributes, &flow_inits);
62
64
}
@@ -72,6 +74,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
72
74
if has_rustc_mir_with(&attributes, sym::stop_after_dataflow).is_some() {
73
75
tcx.sess.fatal("stop_after_dataflow ended compilation");
74
76
}
77
+ */
75
78
}
76
79
}
77
80
@@ -91,16 +94,16 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
91
94
/// (If there are any calls to `rustc_peek` that do not match the
92
95
/// expression form above, then that emits an error as well, but those
93
96
/// errors are not intended to be used for unit tests.)
94
- pub fn sanity_check_via_rustc_peek < ' tcx , O > (
97
+ pub fn sanity_check_via_rustc_peek < ' tcx , A > (
95
98
tcx : TyCtxt < ' tcx > ,
96
99
body : & Body < ' tcx > ,
97
100
def_id : DefId ,
98
101
_attributes : & [ ast:: Attribute ] ,
99
- results : & DataflowResults < ' tcx , O > ,
100
- ) where O : RustcPeekAt < ' tcx > {
102
+ results : & Results < ' tcx , A > ,
103
+ ) where A : RustcPeekAt < ' tcx > {
101
104
debug ! ( "sanity_check_via_rustc_peek def_id: {:?}" , def_id) ;
102
105
103
- let mut cursor = DataflowResultsCursor :: new ( results , body ) ;
106
+ let mut cursor = ResultsCursor :: new ( body , results ) ;
104
107
105
108
let peek_calls = body
106
109
. basic_blocks ( )
@@ -134,9 +137,9 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(
134
137
| ( PeekCallKind :: ByVal , mir:: Rvalue :: Use ( mir:: Operand :: Copy ( place) ) )
135
138
=> {
136
139
let loc = Location { block : bb, statement_index } ;
137
- cursor. seek ( loc) ;
140
+ cursor. seek_before ( loc) ;
138
141
let state = cursor. get ( ) ;
139
- results. operator ( ) . peek_at ( tcx, place, state, call) ;
142
+ results. analysis . peek_at ( tcx, place, state, call) ;
140
143
}
141
144
142
145
_ => {
@@ -240,7 +243,7 @@ impl PeekCall {
240
243
}
241
244
}
242
245
243
- pub trait RustcPeekAt < ' tcx > : BitDenotation < ' tcx > {
246
+ pub trait RustcPeekAt < ' tcx > : Analysis < ' tcx > {
244
247
fn peek_at (
245
248
& self ,
246
249
tcx : TyCtxt < ' tcx > ,
@@ -250,8 +253,8 @@ pub trait RustcPeekAt<'tcx>: BitDenotation<'tcx> {
250
253
) ;
251
254
}
252
255
253
- impl < ' tcx , O > RustcPeekAt < ' tcx > for O
254
- where O : BitDenotation < ' tcx , Idx = MovePathIndex > + HasMoveData < ' tcx > ,
256
+ impl < ' tcx , A > RustcPeekAt < ' tcx > for A
257
+ where A : Analysis < ' tcx , Idx = MovePathIndex > + HasMoveData < ' tcx > ,
255
258
{
256
259
fn peek_at (
257
260
& self ,
@@ -277,6 +280,7 @@ impl<'tcx, O> RustcPeekAt<'tcx> for O
277
280
}
278
281
}
279
282
283
+ /* FIXME: Add this back once `IndirectlyMutableLocals` uses the new dataflow framework.
280
284
impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
281
285
fn peek_at(
282
286
&self,
@@ -298,3 +302,4 @@ impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
298
302
}
299
303
}
300
304
}
305
+ */
0 commit comments