33//! manage the caches, and so forth.
44
55use std:: cell:: Cell ;
6- use std:: collections:: hash_map:: Entry ;
76use std:: fmt:: Debug ;
87use std:: hash:: Hash ;
98use std:: mem;
109
1110use rustc_data_structures:: fingerprint:: Fingerprint ;
12- use rustc_data_structures:: fx:: FxHashMap ;
11+ use rustc_data_structures:: fx:: { FxIndexMap , IndexEntry } ;
1312use rustc_data_structures:: sharded:: Sharded ;
1413use rustc_data_structures:: stack:: ensure_sufficient_stack;
1514use rustc_data_structures:: sync:: Lock ;
@@ -33,7 +32,7 @@ use crate::query::{
3332} ;
3433
3534pub struct QueryState < K > {
36- active : Sharded < FxHashMap < K , QueryResult > > ,
35+ active : Sharded < FxIndexMap < K , QueryResult > > ,
3736}
3837
3938/// Indicates the state of a query for a given key in a query map.
@@ -187,7 +186,7 @@ where
187186 // since unwinding also wants to look at this map, this can also prevent a double
188187 // panic.
189188 let mut lock = state. active . lock_shard_by_value ( & key) ;
190- lock. remove ( & key)
189+ lock. shift_remove ( & key)
191190 } ;
192191 val. unwrap ( ) . expect_job ( )
193192 } ;
@@ -207,7 +206,7 @@ where
207206 let state = self . state ;
208207 let job = {
209208 let mut shard = state. active . lock_shard_by_value ( & self . key ) ;
210- let job = shard. remove ( & self . key ) . unwrap ( ) . expect_job ( ) ;
209+ let job = shard. shift_remove ( & self . key ) . unwrap ( ) . expect_job ( ) ;
211210
212211 shard. insert ( self . key , QueryResult :: Poisoned ) ;
213212 job
@@ -344,7 +343,7 @@ where
344343 let current_job_id = qcx. current_query_job ( ) ;
345344
346345 match state_lock. entry ( key) {
347- Entry :: Vacant ( entry) => {
346+ IndexEntry :: Vacant ( entry) => {
348347 // Nothing has computed or is computing the query, so we start a new job and insert it in the
349348 // state map.
350349 let id = qcx. next_job_id ( ) ;
@@ -356,7 +355,7 @@ where
356355
357356 execute_job :: < _ , _ , INCR > ( query, qcx, state, key, id, dep_node)
358357 }
359- Entry :: Occupied ( mut entry) => {
358+ IndexEntry :: Occupied ( mut entry) => {
360359 match entry. get_mut ( ) {
361360 QueryResult :: Started ( job) => {
362361 #[ cfg( parallel_compiler) ]
0 commit comments