Skip to content

Commit 62c139e

Browse files
committed
Handle rustc_mir_dataflow cases of rustc::potential_query_instability lint
1 parent fda6892 commit 62c139e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ops::Range;
33

44
use rustc_abi::{FieldIdx, VariantIdx};
55
use rustc_data_structures::captures::Captures;
6-
use rustc_data_structures::fx::{FxHashMap, FxIndexSet, StdEntry};
6+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet, IndexEntry};
77
use rustc_data_structures::stack::ensure_sufficient_stack;
88
use rustc_index::IndexVec;
99
use rustc_index::bit_set::BitSet;
@@ -36,12 +36,12 @@ rustc_index::newtype_index!(
3636
pub struct StateData<V> {
3737
bottom: V,
3838
/// This map only contains values that are not `⊥`.
39-
map: FxHashMap<ValueIndex, V>,
39+
map: FxIndexMap<ValueIndex, V>,
4040
}
4141

4242
impl<V: HasBottom> StateData<V> {
4343
fn new() -> StateData<V> {
44-
StateData { bottom: V::BOTTOM, map: FxHashMap::default() }
44+
StateData { bottom: V::BOTTOM, map: FxIndexMap::default() }
4545
}
4646

4747
fn get(&self, idx: ValueIndex) -> &V {
@@ -50,7 +50,7 @@ impl<V: HasBottom> StateData<V> {
5050

5151
fn insert(&mut self, idx: ValueIndex, elem: V) {
5252
if elem.is_bottom() {
53-
self.map.remove(&idx);
53+
self.map.shift_remove(&idx);
5454
} else {
5555
self.map.insert(idx, elem);
5656
}
@@ -70,14 +70,13 @@ impl<V: Clone> Clone for StateData<V> {
7070
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for StateData<V> {
7171
fn join(&mut self, other: &Self) -> bool {
7272
let mut changed = false;
73-
#[allow(rustc::potential_query_instability)]
7473
for (i, v) in other.map.iter() {
7574
match self.map.entry(*i) {
76-
StdEntry::Vacant(e) => {
75+
IndexEntry::Vacant(e) => {
7776
e.insert(v.clone());
7877
changed = true
7978
}
80-
StdEntry::Occupied(e) => changed |= e.into_mut().join(v),
79+
IndexEntry::Occupied(e) => changed |= e.into_mut().join(v),
8180
}
8281
}
8382
changed

0 commit comments

Comments
 (0)