@@ -2,7 +2,7 @@ use super::possible_origin::PossibleOriginVisitor;
2
2
use super::transitive_relation::TransitiveRelation;
3
3
use crate::ty::is_copy;
4
4
use rustc_data_structures::fx::FxHashMap;
5
- use rustc_index::bit_set::BitSet ;
5
+ use rustc_index::bit_set::DenseBitSet ;
6
6
use rustc_lint::LateContext;
7
7
use rustc_middle::mir::visit::Visitor as _;
8
8
use rustc_middle::mir::{self, Mutability};
@@ -21,14 +21,14 @@ struct PossibleBorrowerVisitor<'a, 'b, 'tcx> {
21
21
possible_borrower: TransitiveRelation,
22
22
body: &'b mir::Body<'tcx>,
23
23
cx: &'a LateContext<'tcx>,
24
- possible_origin: FxHashMap<mir::Local, BitSet <mir::Local>>,
24
+ possible_origin: FxHashMap<mir::Local, DenseBitSet <mir::Local>>,
25
25
}
26
26
27
27
impl<'a, 'b, 'tcx> PossibleBorrowerVisitor<'a, 'b, 'tcx> {
28
28
fn new(
29
29
cx: &'a LateContext<'tcx>,
30
30
body: &'b mir::Body<'tcx>,
31
- possible_origin: FxHashMap<mir::Local, BitSet <mir::Local>>,
31
+ possible_origin: FxHashMap<mir::Local, DenseBitSet <mir::Local>>,
32
32
) -> Self {
33
33
Self {
34
34
possible_borrower: TransitiveRelation::default(),
@@ -56,7 +56,7 @@ impl<'a, 'b, 'tcx> PossibleBorrowerVisitor<'a, 'b, 'tcx> {
56
56
}
57
57
}
58
58
59
- let bs = BitSet ::new_empty(self.body.local_decls.len());
59
+ let bs = DenseBitSet ::new_empty(self.body.local_decls.len());
60
60
PossibleBorrowerMap {
61
61
map,
62
62
maybe_live,
@@ -119,7 +119,7 @@ impl<'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'_, '_, 'tcx> {
119
119
let mut mutable_variables: Vec<mir::Local> = mutable_borrowers
120
120
.iter()
121
121
.filter_map(|r| self.possible_origin.get(r))
122
- .flat_map(BitSet ::iter)
122
+ .flat_map(DenseBitSet ::iter)
123
123
.collect();
124
124
125
125
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)) {
171
171
#[allow(clippy::module_name_repetitions)]
172
172
pub struct PossibleBorrowerMap<'b, 'tcx> {
173
173
/// Mapping `Local -> its possible borrowers`
174
- pub map: FxHashMap<mir::Local, BitSet <mir::Local>>,
174
+ pub map: FxHashMap<mir::Local, DenseBitSet <mir::Local>>,
175
175
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>),
178
178
}
179
179
180
180
impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
@@ -184,7 +184,7 @@ impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
184
184
vis.visit_body(mir);
185
185
vis.into_map(cx)
186
186
};
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())))
188
188
.iterate_to_fixpoint(cx.tcx, mir, Some("redundant_clone"))
189
189
.into_results_cursor(mir);
190
190
let mut vis = PossibleBorrowerVisitor::new(cx, mir, possible_origin);
0 commit comments