Skip to content

Commit 874b03e

Browse files
committed
Remove ResultsCursor::contains.
It's hardly worth it, and it needs to be removed so that `GenKillAnalysis` can be removed.
1 parent 5ceb623 commit 874b03e

File tree

5 files changed

+5
-16
lines changed

5 files changed

+5
-16
lines changed

compiler/rustc_mir_dataflow/src/framework/cursor.rs

-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_index::bit_set::BitSet;
77
use rustc_middle::mir::{self, BasicBlock, Location};
88

99
use super::{Analysis, Direction, Effect, EffectIndex, Results};
10-
use crate::framework::BitSetExt;
1110

1211
/// Allows random access inspection of the results of a dataflow analysis.
1312
///
@@ -221,16 +220,6 @@ where
221220
}
222221
}
223222

224-
impl<'mir, 'tcx, A> ResultsCursor<'mir, 'tcx, A>
225-
where
226-
A: crate::GenKillAnalysis<'tcx>,
227-
A::Domain: BitSetExt<A::Idx>,
228-
{
229-
pub fn contains(&self, elem: A::Idx) -> bool {
230-
self.get().contains(elem)
231-
}
232-
}
233-
234223
#[derive(Clone, Copy, Debug)]
235224
struct CursorPosition {
236225
block: BasicBlock,

compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ where
364364
fn visit_local(&mut self, local: Local, context: PlaceContext, loc: Location) {
365365
if PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) == context {
366366
self.borrowed_locals.seek_before_primary_effect(loc);
367-
if !self.borrowed_locals.contains(local) {
367+
if !self.borrowed_locals.get().contains(local) {
368368
self.trans.kill(local);
369369
}
370370
}

compiler/rustc_mir_transform/src/elaborate_drops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl InitializationData<'_, '_> {
133133
}
134134

135135
fn maybe_live_dead(&self, path: MovePathIndex) -> (bool, bool) {
136-
(self.inits.contains(path), self.uninits.contains(path))
136+
(self.inits.get().contains(path), self.uninits.get().contains(path))
137137
}
138138
}
139139

compiler/rustc_mir_transform/src/ref_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fn compute_replacement<'tcx>(
179179
} else {
180180
// This is a proper dereference. We can only allow it if `target` is live.
181181
maybe_dead.seek_after_primary_effect(loc);
182-
let maybe_dead = maybe_dead.contains(target.local);
182+
let maybe_dead = maybe_dead.get().contains(target.local);
183183
!maybe_dead
184184
}
185185
};

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
213213
self.bitset.0.clear();
214214
let maybe_live = &mut self.maybe_live;
215215
if let Some(bitset) = self.map.get(&borrowed) {
216-
for b in bitset.iter().filter(move |b| maybe_live.contains(*b)) {
216+
for b in bitset.iter().filter(move |b| maybe_live.get().contains(*b)) {
217217
self.bitset.0.insert(b);
218218
}
219219
} else {
@@ -238,6 +238,6 @@ impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
238238

239239
pub fn local_is_alive_at(&mut self, local: mir::Local, at: mir::Location) -> bool {
240240
self.maybe_live.seek_after_primary_effect(at);
241-
self.maybe_live.contains(local)
241+
self.maybe_live.get().contains(local)
242242
}
243243
}

0 commit comments

Comments
 (0)