@@ -2,7 +2,7 @@ use super::possible_origin::PossibleOriginVisitor;
22use super :: transitive_relation:: TransitiveRelation ;
33use crate :: ty:: is_copy;
44use rustc_data_structures:: fx:: FxHashMap ;
5- use rustc_index:: bit_set:: BitSet ;
5+ use rustc_index:: bit_set:: DenseBitSet ;
66use rustc_lint:: LateContext ;
77use rustc_middle:: mir:: visit:: Visitor as _;
88use rustc_middle:: mir:: { self , Mutability } ;
@@ -21,14 +21,14 @@ struct PossibleBorrowerVisitor<'a, 'b, 'tcx> {
2121 possible_borrower : TransitiveRelation ,
2222 body : & ' b mir:: Body < ' tcx > ,
2323 cx : & ' a LateContext < ' tcx > ,
24- possible_origin : FxHashMap < mir:: Local , BitSet < mir:: Local > > ,
24+ possible_origin : FxHashMap < mir:: Local , DenseBitSet < mir:: Local > > ,
2525}
2626
2727impl < ' a , ' b , ' tcx > PossibleBorrowerVisitor < ' a , ' b , ' tcx > {
2828 fn new (
2929 cx : & ' a LateContext < ' tcx > ,
3030 body : & ' b mir:: Body < ' tcx > ,
31- possible_origin : FxHashMap < mir:: Local , BitSet < mir:: Local > > ,
31+ possible_origin : FxHashMap < mir:: Local , DenseBitSet < mir:: Local > > ,
3232 ) -> Self {
3333 Self {
3434 possible_borrower : TransitiveRelation :: default ( ) ,
@@ -56,7 +56,7 @@ impl<'a, 'b, 'tcx> PossibleBorrowerVisitor<'a, 'b, 'tcx> {
5656 }
5757 }
5858
59- let bs = BitSet :: new_empty ( self . body . local_decls . len ( ) ) ;
59+ let bs = DenseBitSet :: new_empty ( self . body . local_decls . len ( ) ) ;
6060 PossibleBorrowerMap {
6161 map,
6262 maybe_live,
@@ -119,7 +119,7 @@ impl<'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'_, '_, 'tcx> {
119119 let mut mutable_variables: Vec < mir:: Local > = mutable_borrowers
120120 . iter ( )
121121 . filter_map ( |r| self . possible_origin . get ( r) )
122- . flat_map ( BitSet :: iter)
122+ . flat_map ( DenseBitSet :: iter)
123123 . collect ( ) ;
124124
125125 if ContainsRegion . visit_ty ( self . body . local_decls [ * dest] . ty ) . is_break ( ) {
@@ -171,10 +171,10 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
171171#[ allow( clippy:: module_name_repetitions) ]
172172pub struct PossibleBorrowerMap < ' b , ' tcx > {
173173 /// Mapping `Local -> its possible borrowers`
174- pub map : FxHashMap < mir:: Local , BitSet < mir:: Local > > ,
174+ pub map : FxHashMap < mir:: Local , DenseBitSet < mir:: Local > > ,
175175 maybe_live : ResultsCursor < ' b , ' tcx , MaybeStorageLive < ' tcx > > ,
176- // Caches to avoid allocation of `BitSet ` on every query
177- pub bitset : ( BitSet < mir:: Local > , BitSet < mir:: Local > ) ,
176+ // Caches to avoid allocation of `DenseBitSet ` on every query
177+ pub bitset : ( DenseBitSet < mir:: Local > , DenseBitSet < mir:: Local > ) ,
178178}
179179
180180impl < ' b , ' tcx > PossibleBorrowerMap < ' b , ' tcx > {
@@ -184,7 +184,7 @@ impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
184184 vis. visit_body ( mir) ;
185185 vis. into_map ( cx)
186186 } ;
187- let maybe_storage_live_result = MaybeStorageLive :: new ( Cow :: Owned ( BitSet :: new_empty ( mir. local_decls . len ( ) ) ) )
187+ let maybe_storage_live_result = MaybeStorageLive :: new ( Cow :: Owned ( DenseBitSet :: new_empty ( mir. local_decls . len ( ) ) ) )
188188 . iterate_to_fixpoint ( cx. tcx , mir, Some ( "redundant_clone" ) )
189189 . into_results_cursor ( mir) ;
190190 let mut vis = PossibleBorrowerVisitor :: new ( cx, mir, possible_origin) ;
0 commit comments