@@ -14,7 +14,6 @@ use rustc_middle::mir::{
14
14
visit:: { MutatingUseContext , NonMutatingUseContext , PlaceContext , Visitor as _} ,
15
15
} ;
16
16
use rustc_middle:: ty:: { self , fold:: TypeVisitor , Ty } ;
17
- use rustc_mir:: dataflow:: BottomValue ;
18
17
use rustc_mir:: dataflow:: { Analysis , AnalysisDomain , GenKill , GenKillAnalysis , ResultsCursor } ;
19
18
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
20
19
use rustc_span:: source_map:: { BytePos , Span } ;
@@ -411,21 +410,24 @@ impl<'tcx> mir::visit::Visitor<'tcx> for LocalUseVisitor {
411
410
struct MaybeStorageLive ;
412
411
413
412
impl < ' tcx > AnalysisDomain < ' tcx > for MaybeStorageLive {
414
- type Idx = mir:: Local ;
413
+ type Domain = BitSet < mir:: Local > ;
415
414
const NAME : & ' static str = "maybe_storage_live" ;
416
415
417
- fn bits_per_block ( & self , body : & mir:: Body < ' tcx > ) -> usize {
418
- body. local_decls . len ( )
416
+ fn bottom_value ( & self , body : & mir:: Body < ' tcx > ) -> Self :: Domain {
417
+ // bottom = dead
418
+ BitSet :: new_empty ( body. local_decls . len ( ) )
419
419
}
420
420
421
- fn initialize_start_block ( & self , body : & mir:: Body < ' tcx > , state : & mut BitSet < Self :: Idx > ) {
421
+ fn initialize_start_block ( & self , body : & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
422
422
for arg in body. args_iter ( ) {
423
423
state. insert ( arg) ;
424
424
}
425
425
}
426
426
}
427
427
428
428
impl < ' tcx > GenKillAnalysis < ' tcx > for MaybeStorageLive {
429
+ type Idx = mir:: Local ;
430
+
429
431
fn statement_effect ( & self , trans : & mut impl GenKill < Self :: Idx > , stmt : & mir:: Statement < ' tcx > , _: mir:: Location ) {
430
432
match stmt. kind {
431
433
mir:: StatementKind :: StorageLive ( l) => trans. gen ( l) ,
@@ -454,11 +456,6 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
454
456
}
455
457
}
456
458
457
- impl BottomValue for MaybeStorageLive {
458
- /// bottom = dead
459
- const BOTTOM_VALUE : bool = false ;
460
- }
461
-
462
459
/// Collects the possible borrowers of each local.
463
460
/// For example, `b = &a; c = &a;` will make `b` and (transitively) `c`
464
461
/// possible borrowers of `a`.
0 commit comments