Skip to content

Commit 3c09e88

Browse files
committed
Handle rustc_mir_dataflow cases of rustc::potential_query_instability lint
1 parent 5a4ee43 commit 3c09e88

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
@@ -37,7 +37,7 @@ use std::fmt::{Debug, Formatter};
3737
use std::ops::Range;
3838

3939
use rustc_data_structures::captures::Captures;
40-
use rustc_data_structures::fx::{FxHashMap, FxIndexSet, StdEntry};
40+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet, IndexEntry};
4141
use rustc_data_structures::stack::ensure_sufficient_stack;
4242
use rustc_index::IndexVec;
4343
use rustc_index::bit_set::BitSet;
@@ -421,12 +421,12 @@ rustc_index::newtype_index!(
421421
pub struct StateData<V> {
422422
bottom: V,
423423
/// This map only contains values that are not `⊥`.
424-
map: FxHashMap<ValueIndex, V>,
424+
map: FxIndexMap<ValueIndex, V>,
425425
}
426426

427427
impl<V: HasBottom> StateData<V> {
428428
fn new() -> StateData<V> {
429-
StateData { bottom: V::BOTTOM, map: FxHashMap::default() }
429+
StateData { bottom: V::BOTTOM, map: FxIndexMap::default() }
430430
}
431431

432432
fn get(&self, idx: ValueIndex) -> &V {
@@ -435,7 +435,7 @@ impl<V: HasBottom> StateData<V> {
435435

436436
fn insert(&mut self, idx: ValueIndex, elem: V) {
437437
if elem.is_bottom() {
438-
self.map.remove(&idx);
438+
self.map.shift_remove(&idx);
439439
} else {
440440
self.map.insert(idx, elem);
441441
}
@@ -455,14 +455,13 @@ impl<V: Clone> Clone for StateData<V> {
455455
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for StateData<V> {
456456
fn join(&mut self, other: &Self) -> bool {
457457
let mut changed = false;
458-
#[allow(rustc::potential_query_instability)]
459458
for (i, v) in other.map.iter() {
460459
match self.map.entry(*i) {
461-
StdEntry::Vacant(e) => {
460+
IndexEntry::Vacant(e) => {
462461
e.insert(v.clone());
463462
changed = true
464463
}
465-
StdEntry::Occupied(e) => changed |= e.into_mut().join(v),
464+
IndexEntry::Occupied(e) => changed |= e.into_mut().join(v),
466465
}
467466
}
468467
changed

0 commit comments

Comments
 (0)