@@ -9,24 +9,24 @@ use rustc::mir::{self, Body, BodyAndCache, 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 BodyAndCache < ' 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
}
@@ -82,6 +84,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
82
84
if has_rustc_mir_with(&attributes, sym::stop_after_dataflow).is_some() {
83
85
tcx.sess.fatal("stop_after_dataflow ended compilation");
84
86
}
87
+ */
85
88
}
86
89
}
87
90
@@ -101,16 +104,16 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
101
104
/// (If there are any calls to `rustc_peek` that do not match the
102
105
/// expression form above, then that emits an error as well, but those
103
106
/// errors are not intended to be used for unit tests.)
104
- pub fn sanity_check_via_rustc_peek < ' tcx , O > (
107
+ pub fn sanity_check_via_rustc_peek < ' tcx , A > (
105
108
tcx : TyCtxt < ' tcx > ,
106
109
body : & Body < ' tcx > ,
107
110
def_id : DefId ,
108
111
_attributes : & [ ast:: Attribute ] ,
109
- results : & DataflowResults < ' tcx , O > ,
110
- ) where O : RustcPeekAt < ' tcx > {
112
+ results : & Results < ' tcx , A > ,
113
+ ) where A : RustcPeekAt < ' tcx > {
111
114
debug ! ( "sanity_check_via_rustc_peek def_id: {:?}" , def_id) ;
112
115
113
- let mut cursor = DataflowResultsCursor :: new ( results , body ) ;
116
+ let mut cursor = ResultsCursor :: new ( body , results ) ;
114
117
115
118
let peek_calls = body
116
119
. basic_blocks ( )
@@ -144,9 +147,9 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(
144
147
| ( PeekCallKind :: ByVal , mir:: Rvalue :: Use ( mir:: Operand :: Copy ( place) ) )
145
148
=> {
146
149
let loc = Location { block : bb, statement_index } ;
147
- cursor. seek ( loc) ;
150
+ cursor. seek_before ( loc) ;
148
151
let state = cursor. get ( ) ;
149
- results. operator ( ) . peek_at ( tcx, place, state, call) ;
152
+ results. analysis . peek_at ( tcx, place, state, call) ;
150
153
}
151
154
152
155
_ => {
@@ -250,7 +253,7 @@ impl PeekCall {
250
253
}
251
254
}
252
255
253
- pub trait RustcPeekAt < ' tcx > : BitDenotation < ' tcx > {
256
+ pub trait RustcPeekAt < ' tcx > : Analysis < ' tcx > {
254
257
fn peek_at (
255
258
& self ,
256
259
tcx : TyCtxt < ' tcx > ,
@@ -260,8 +263,8 @@ pub trait RustcPeekAt<'tcx>: BitDenotation<'tcx> {
260
263
) ;
261
264
}
262
265
263
- impl < ' tcx , O > RustcPeekAt < ' tcx > for O
264
- where O : BitDenotation < ' tcx , Idx = MovePathIndex > + HasMoveData < ' tcx > ,
266
+ impl < ' tcx , A > RustcPeekAt < ' tcx > for A
267
+ where A : Analysis < ' tcx , Idx = MovePathIndex > + HasMoveData < ' tcx > ,
265
268
{
266
269
fn peek_at (
267
270
& self ,
@@ -287,6 +290,7 @@ impl<'tcx, O> RustcPeekAt<'tcx> for O
287
290
}
288
291
}
289
292
293
+ /* FIXME: Add this back once `IndirectlyMutableLocals` uses the new dataflow framework.
290
294
impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
291
295
fn peek_at(
292
296
&self,
@@ -308,3 +312,4 @@ impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
308
312
}
309
313
}
310
314
}
315
+ */
0 commit comments