11
11
#![ allow( warnings) ]
12
12
13
13
use std:: mem;
14
+ use rustc_data_structures:: fx:: FxHashSet ;
14
15
use rustc_data_structures:: sync:: { Lock , LockGuard , Lrc , Weak } ;
15
16
use rustc_data_structures:: OnDrop ;
16
17
use syntax_pos:: Span ;
@@ -21,7 +22,7 @@ use ty::context::TyCtxt;
21
22
use errors:: Diagnostic ;
22
23
use std:: process;
23
24
use std:: { fmt, ptr} ;
24
- use std :: collections :: HashSet ;
25
+
25
26
#[ cfg( parallel_queries) ]
26
27
use {
27
28
rayon_core,
@@ -282,7 +283,7 @@ where
282
283
fn cycle_check < ' tcx > ( query : Lrc < QueryJob < ' tcx > > ,
283
284
span : Span ,
284
285
stack : & mut Vec < ( Span , Lrc < QueryJob < ' tcx > > ) > ,
285
- visited : & mut HashSet < * const QueryJob < ' tcx > >
286
+ visited : & mut FxHashSet < * const QueryJob < ' tcx > >
286
287
) -> Option < Option < Waiter < ' tcx > > > {
287
288
if visited. contains ( & query. as_ptr ( ) ) {
288
289
return if let Some ( p) = stack. iter ( ) . position ( |q| q. 1 . as_ptr ( ) == query. as_ptr ( ) ) {
@@ -321,7 +322,7 @@ fn cycle_check<'tcx>(query: Lrc<QueryJob<'tcx>>,
321
322
#[ cfg( parallel_queries) ]
322
323
fn connected_to_root < ' tcx > (
323
324
query : Lrc < QueryJob < ' tcx > > ,
324
- visited : & mut HashSet < * const QueryJob < ' tcx > >
325
+ visited : & mut FxHashSet < * const QueryJob < ' tcx > >
325
326
) -> bool {
326
327
// We already visited this or we're deliberately ignoring it
327
328
if visited. contains ( & query. as_ptr ( ) ) {
@@ -357,7 +358,7 @@ fn remove_cycle<'tcx>(
357
358
wakelist : & mut Vec < Lrc < QueryWaiter < ' tcx > > > ,
358
359
tcx : TyCtxt < ' _ , ' tcx , ' _ >
359
360
) -> bool {
360
- let mut visited = HashSet :: new ( ) ;
361
+ let mut visited = FxHashSet :: default ( ) ;
361
362
let mut stack = Vec :: new ( ) ;
362
363
// Look for a cycle starting with the last query in `jobs`
363
364
if let Some ( waiter) = cycle_check ( jobs. pop ( ) . unwrap ( ) ,
@@ -389,7 +390,7 @@ fn remove_cycle<'tcx>(
389
390
// connected to queries outside the cycle
390
391
let entry_points: Vec < Lrc < QueryJob < ' tcx > > > = stack. iter ( ) . filter_map ( |query| {
391
392
// Mark all the other queries in the cycle as already visited
392
- let mut visited = HashSet :: from_iter ( stack. iter ( ) . filter_map ( |q| {
393
+ let mut visited = FxHashSet :: from_iter ( stack. iter ( ) . filter_map ( |q| {
393
394
if q. 1 . as_ptr ( ) != query. 1 . as_ptr ( ) {
394
395
Some ( q. 1 . as_ptr ( ) )
395
396
} else {
0 commit comments