@@ -12,9 +12,8 @@ use rustc_index::bit_set::BitSet;
12
12
use crate :: dataflow:: generic:: { Analysis , Results , ResultsCursor } ;
13
13
use crate :: dataflow:: move_paths:: { HasMoveData , MoveData } ;
14
14
use crate :: dataflow:: move_paths:: { LookupResult , MovePathIndex } ;
15
- use crate :: dataflow:: IndirectlyMutableLocals ;
15
+ use crate :: dataflow:: MaybeMutBorrowedLocals ;
16
16
use crate :: dataflow:: MoveDataParamEnv ;
17
- use crate :: dataflow:: { do_dataflow, DebugFormatted } ;
18
17
use crate :: dataflow:: {
19
18
DefinitelyInitializedPlaces , MaybeInitializedPlaces , MaybeUninitializedPlaces ,
20
19
} ;
@@ -24,7 +23,6 @@ pub struct SanityCheck;
24
23
impl < ' tcx > MirPass < ' tcx > for SanityCheck {
25
24
fn run_pass ( & self , tcx : TyCtxt < ' tcx > , src : MirSource < ' tcx > , body : & mut BodyAndCache < ' tcx > ) {
26
25
use crate :: dataflow:: has_rustc_mir_with;
27
-
28
26
let def_id = src. def_id ( ) ;
29
27
if !tcx. has_attr ( def_id, sym:: rustc_mir) {
30
28
debug ! ( "skipping rustc_peek::SanityCheck on {}" , tcx. def_path_str( def_id) ) ;
@@ -37,7 +35,6 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
37
35
let param_env = tcx. param_env ( def_id) ;
38
36
let move_data = MoveData :: gather_moves ( body, tcx, param_env) . unwrap ( ) ;
39
37
let mdpe = MoveDataParamEnv { move_data : move_data, param_env : param_env } ;
40
- let dead_unwinds = BitSet :: new_empty ( body. basic_blocks ( ) . len ( ) ) ;
41
38
42
39
let flow_inits = MaybeInitializedPlaces :: new ( tcx, body, & mdpe)
43
40
. into_engine ( tcx, body, def_id)
@@ -48,15 +45,9 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
48
45
let flow_def_inits = DefinitelyInitializedPlaces :: new ( tcx, body, & mdpe)
49
46
. into_engine ( tcx, body, def_id)
50
47
. iterate_to_fixpoint ( ) ;
51
- let _flow_indirectly_mut = do_dataflow (
52
- tcx,
53
- body,
54
- def_id,
55
- & attributes,
56
- & dead_unwinds,
57
- IndirectlyMutableLocals :: new ( tcx, body, param_env) ,
58
- |_, i| DebugFormatted :: new ( & i) ,
59
- ) ;
48
+ let flow_mut_borrowed = MaybeMutBorrowedLocals :: new_mut_only ( tcx, body, param_env)
49
+ . into_engine ( tcx, body, def_id)
50
+ . iterate_to_fixpoint ( ) ;
60
51
61
52
if has_rustc_mir_with ( & attributes, sym:: rustc_peek_maybe_init) . is_some ( ) {
62
53
sanity_check_via_rustc_peek ( tcx, body, def_id, & attributes, & flow_inits) ;
@@ -67,12 +58,9 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
67
58
if has_rustc_mir_with ( & attributes, sym:: rustc_peek_definite_init) . is_some ( ) {
68
59
sanity_check_via_rustc_peek ( tcx, body, def_id, & attributes, & flow_def_inits) ;
69
60
}
70
- // FIXME: Uncomment these as analyses are migrated to the new framework
71
- /*
72
61
if has_rustc_mir_with ( & attributes, sym:: rustc_peek_indirectly_mutable) . is_some ( ) {
73
- sanity_check_via_rustc_peek(tcx, body, def_id, &attributes, &flow_indirectly_mut );
62
+ sanity_check_via_rustc_peek ( tcx, body, def_id, & attributes, & flow_mut_borrowed ) ;
74
63
}
75
- */
76
64
if has_rustc_mir_with ( & attributes, sym:: stop_after_dataflow) . is_some ( ) {
77
65
tcx. sess . fatal ( "stop_after_dataflow ended compilation" ) ;
78
66
}
@@ -276,8 +264,7 @@ where
276
264
}
277
265
}
278
266
279
- /* FIXME: Add this back once `IndirectlyMutableLocals` uses the new dataflow framework.
280
- impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
267
+ impl < ' tcx > RustcPeekAt < ' tcx > for MaybeMutBorrowedLocals < ' _ , ' tcx > {
281
268
fn peek_at (
282
269
& self ,
283
270
tcx : TyCtxt < ' tcx > ,
@@ -298,4 +285,3 @@ impl<'tcx> RustcPeekAt<'tcx> for IndirectlyMutableLocals<'_, 'tcx> {
298
285
}
299
286
}
300
287
}
301
- */
0 commit comments