Remove ResultsCursor::contains.

It's hardly worth it, and it needs to be removed so that
`GenKillAnalysis` can be removed.
This commit is contained in:
Nicholas Nethercote 2024-10-10 11:21:16 +11:00
parent 5ceb623a4a
commit 874b03ec28
5 changed files with 5 additions and 16 deletions

View file

@ -7,7 +7,6 @@ use rustc_index::bit_set::BitSet;
use rustc_middle::mir::{self, BasicBlock, Location};
use super::{Analysis, Direction, Effect, EffectIndex, Results};
use crate::framework::BitSetExt;
/// Allows random access inspection of the results of a dataflow analysis.
///
@ -221,16 +220,6 @@ where
}
}
impl<'mir, 'tcx, A> ResultsCursor<'mir, 'tcx, A>
where
A: crate::GenKillAnalysis<'tcx>,
A::Domain: BitSetExt<A::Idx>,
{
pub fn contains(&self, elem: A::Idx) -> bool {
self.get().contains(elem)
}
}
#[derive(Clone, Copy, Debug)]
struct CursorPosition {
block: BasicBlock,

View file

@ -364,7 +364,7 @@ where
fn visit_local(&mut self, local: Local, context: PlaceContext, loc: Location) {
if PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) == context {
self.borrowed_locals.seek_before_primary_effect(loc);
if !self.borrowed_locals.contains(local) {
if !self.borrowed_locals.get().contains(local) {
self.trans.kill(local);
}
}

View file

@ -133,7 +133,7 @@ impl InitializationData<'_, '_> {
}
fn maybe_live_dead(&self, path: MovePathIndex) -> (bool, bool) {
(self.inits.contains(path), self.uninits.contains(path))
(self.inits.get().contains(path), self.uninits.get().contains(path))
}
}

View file

@ -179,7 +179,7 @@ fn compute_replacement<'tcx>(
} else {
// This is a proper dereference. We can only allow it if `target` is live.
maybe_dead.seek_after_primary_effect(loc);
let maybe_dead = maybe_dead.contains(target.local);
let maybe_dead = maybe_dead.get().contains(target.local);
!maybe_dead
}
};