Skip to content

Commit 95cbb3b

Browse files
committed
migrate clippy to the DenseBitSet name
1 parent afa1943 commit 95cbb3b

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/tools/clippy/clippy_lints/src/needless_borrows_for_generic_args.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_errors::Applicability;
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::def_id::{DefId, LocalDefId};
1111
use rustc_hir::{Body, Expr, ExprKind, Mutability, Path, QPath};
12-
use rustc_index::bit_set::BitSet;
12+
use rustc_index::bit_set::DenseBitSet;
1313
use rustc_infer::infer::TyCtxtInferExt;
1414
use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_middle::mir::{Rvalue, StatementKind};
@@ -390,7 +390,7 @@ fn replace_types<'tcx>(
390390
projection_predicates: &[ProjectionPredicate<'tcx>],
391391
args: &mut [GenericArg<'tcx>],
392392
) -> bool {
393-
let mut replaced = BitSet::new_empty(args.len());
393+
let mut replaced = DenseBitSet::new_empty(args.len());
394394

395395
let mut deque = VecDeque::with_capacity(args.len());
396396
deque.push_back((param_ty, new_ty));

src/tools/clippy/clippy_utils/src/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_hir::{Expr, HirId};
2-
use rustc_index::bit_set::BitSet;
2+
use rustc_index::bit_set::DenseBitSet;
33
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
44
use rustc_middle::mir::{
55
BasicBlock, Body, InlineAsmOperand, Local, Location, Place, START_BLOCK, StatementKind, TerminatorKind, traversal,
@@ -88,7 +88,7 @@ impl<'tcx> Visitor<'tcx> for V<'_> {
8888

8989
/// Checks if the block is part of a cycle
9090
pub fn block_in_cycle(body: &Body<'_>, block: BasicBlock) -> bool {
91-
let mut seen = BitSet::new_empty(body.basic_blocks.len());
91+
let mut seen = DenseBitSet::new_empty(body.basic_blocks.len());
9292
let mut to_visit = Vec::with_capacity(body.basic_blocks.len() / 2);
9393

9494
seen.insert(block);

src/tools/clippy/clippy_utils/src/mir/possible_borrower.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::possible_origin::PossibleOriginVisitor;
22
use super::transitive_relation::TransitiveRelation;
33
use crate::ty::is_copy;
44
use rustc_data_structures::fx::FxHashMap;
5-
use rustc_index::bit_set::BitSet;
5+
use rustc_index::bit_set::DenseBitSet;
66
use rustc_lint::LateContext;
77
use rustc_middle::mir::visit::Visitor as _;
88
use 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

2727
impl<'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)]
172172
pub 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

180180
impl<'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);

src/tools/clippy/clippy_utils/src/mir/possible_origin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::transitive_relation::TransitiveRelation;
22
use crate::ty::is_copy;
33
use rustc_data_structures::fx::FxHashMap;
4-
use rustc_index::bit_set::BitSet;
4+
use rustc_index::bit_set::DenseBitSet;
55
use rustc_lint::LateContext;
66
use rustc_middle::mir;
77

@@ -22,7 +22,7 @@ impl<'a, 'tcx> PossibleOriginVisitor<'a, 'tcx> {
2222
}
2323
}
2424

25-
pub fn into_map(self, cx: &LateContext<'tcx>) -> FxHashMap<mir::Local, BitSet<mir::Local>> {
25+
pub fn into_map(self, cx: &LateContext<'tcx>) -> FxHashMap<mir::Local, DenseBitSet<mir::Local>> {
2626
let mut map = FxHashMap::default();
2727
for row in (1..self.body.local_decls.len()).map(mir::Local::from_usize) {
2828
if is_copy(cx, self.body.local_decls[row].ty) {

src/tools/clippy/clippy_utils/src/mir/transitive_relation.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_data_structures::fx::FxHashMap;
2-
use rustc_index::bit_set::BitSet;
2+
use rustc_index::bit_set::DenseBitSet;
33
use rustc_middle::mir;
44

55
#[derive(Default)]
@@ -12,8 +12,8 @@ impl TransitiveRelation {
1212
self.relations.entry(a).or_default().push(b);
1313
}
1414

15-
pub fn reachable_from(&self, a: mir::Local, domain_size: usize) -> BitSet<mir::Local> {
16-
let mut seen = BitSet::new_empty(domain_size);
15+
pub fn reachable_from(&self, a: mir::Local, domain_size: usize) -> DenseBitSet<mir::Local> {
16+
let mut seen = DenseBitSet::new_empty(domain_size);
1717
let mut stack = vec![a];
1818
while let Some(u) = stack.pop() {
1919
if let Some(edges) = self.relations.get(&u) {

0 commit comments

Comments
 (0)