@@ -9,24 +9,24 @@ use rustc::mir::{self, Body, Location, Local};
99use rustc_index:: bit_set:: BitSet ;
1010use crate :: transform:: { MirPass , MirSource } ;
1111
12+ use crate :: dataflow:: generic:: { Analysis , Results , ResultsCursor } ;
1213use crate :: dataflow:: { do_dataflow, DebugFormatted } ;
1314use crate :: dataflow:: MoveDataParamEnv ;
14- use crate :: dataflow:: BitDenotation ;
15- use crate :: dataflow:: DataflowResults ;
16- use crate :: dataflow:: DataflowResultsCursor ;
1715use crate :: dataflow:: {
1816 DefinitelyInitializedPlaces , MaybeInitializedPlaces , MaybeUninitializedPlaces
1917} ;
2018use crate :: dataflow:: IndirectlyMutableLocals ;
2119use crate :: dataflow:: move_paths:: { MovePathIndex , LookupResult } ;
2220use crate :: dataflow:: move_paths:: { HasMoveData , MoveData } ;
2321
24- use crate :: dataflow:: has_rustc_mir_with;
2522
2623pub struct SanityCheck ;
2724
2825impl < ' tcx > MirPass < ' tcx > for SanityCheck {
26+ #[ allow( unused) ]
2927 fn run_pass ( & self , tcx : TyCtxt < ' tcx > , src : MirSource < ' tcx > , body : & mut Body < ' tcx > ) {
28+ use crate :: dataflow:: has_rustc_mir_with;
29+
3030 let def_id = src. def_id ( ) ;
3131 if !tcx. has_attr ( def_id, sym:: rustc_mir) {
3232 debug ! ( "skipping rustc_peek::SanityCheck on {}" , tcx. def_path_str( def_id) ) ;
@@ -57,6 +57,8 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
5757 IndirectlyMutableLocals :: new ( tcx, body, param_env) ,
5858 |_, i| DebugFormatted :: new ( & i) ) ;
5959
60+ // FIXME: add these back as dataflow analyses are migrated
61+ /*
6062 if has_rustc_mir_with(&attributes, sym::rustc_peek_maybe_init).is_some() {
6163 sanity_check_via_rustc_peek(tcx, body, def_id, &attributes, &flow_inits);
6264 }
@@ -72,6 +74,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
7274 if has_rustc_mir_with(&attributes, sym::stop_after_dataflow).is_some() {
7375 tcx.sess.fatal("stop_after_dataflow ended compilation");
7476 }
77+ */
7578 }
7679}
7780
@@ -91,16 +94,16 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
9194/// (If there are any calls to `rustc_peek` that do not match the
9295/// expression form above, then that emits an error as well, but those
9396/// 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 > (
9598 tcx : TyCtxt < ' tcx > ,
9699 body : & Body < ' tcx > ,
97100 def_id : DefId ,
98101 _attributes : & [ ast:: Attribute ] ,
99- results : & DataflowResults < ' tcx , O > ,
100- ) where O : RustcPeekAt < ' tcx > {
102+ results : & Results < ' tcx , A > ,
103+ ) where A : RustcPeekAt < ' tcx > {
101104 debug ! ( "sanity_check_via_rustc_peek def_id: {:?}" , def_id) ;
102105
103- let mut cursor = DataflowResultsCursor :: new ( results , body ) ;
106+ let mut cursor = ResultsCursor :: new ( body , results ) ;
104107
105108 let peek_calls = body
106109 . basic_blocks ( )
@@ -134,9 +137,9 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(
134137 | ( PeekCallKind :: ByVal , mir:: Rvalue :: Use ( mir:: Operand :: Copy ( place) ) )
135138 => {
136139 let loc = Location { block : bb, statement_index } ;
137- cursor. seek ( loc) ;
140+ cursor. seek_before ( loc) ;
138141 let state = cursor. get ( ) ;
139- results. operator ( ) . peek_at ( tcx, place, state, call) ;
142+ results. analysis . peek_at ( tcx, place, state, call) ;
140143 }
141144
142145 _ => {
@@ -240,7 +243,7 @@ impl PeekCall {
240243 }
241244}
242245
243- pub trait RustcPeekAt < ' tcx > : BitDenotation < ' tcx > {
246+ pub trait RustcPeekAt < ' tcx > : Analysis < ' tcx > {
244247 fn peek_at (
245248 & self ,
246249 tcx : TyCtxt < ' tcx > ,
@@ -250,8 +253,8 @@ pub trait RustcPeekAt<'tcx>: BitDenotation<'tcx> {
250253 ) ;
251254}
252255
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 > ,
255258{
256259 fn peek_at (
257260 & self ,
@@ -277,6 +280,7 @@ impl<'tcx, O> RustcPeekAt<'tcx> for O
277280 }
278281}
279282
283+ /* FIXME: Add this back once `IndirectlyMutableLocals` uses the new dataflow framework.
280284impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
281285 fn peek_at(
282286 &self,
@@ -298,3 +302,4 @@ impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
298302 }
299303 }
300304}
305+ */
0 commit comments