1111#![ allow( warnings) ]
1212
1313use std:: mem;
14+ use rustc_data_structures:: fx:: FxHashSet ;
1415use rustc_data_structures:: sync:: { Lock , LockGuard , Lrc , Weak } ;
1516use rustc_data_structures:: OnDrop ;
1617use syntax_pos:: Span ;
@@ -21,7 +22,7 @@ use ty::context::TyCtxt;
2122use errors:: Diagnostic ;
2223use std:: process;
2324use std:: { fmt, ptr} ;
24- use std :: collections :: HashSet ;
25+
2526#[ cfg( parallel_queries) ]
2627use {
2728 rayon_core,
@@ -282,7 +283,7 @@ where
282283fn cycle_check < ' tcx > ( query : Lrc < QueryJob < ' tcx > > ,
283284 span : Span ,
284285 stack : & mut Vec < ( Span , Lrc < QueryJob < ' tcx > > ) > ,
285- visited : & mut HashSet < * const QueryJob < ' tcx > >
286+ visited : & mut FxHashSet < * const QueryJob < ' tcx > >
286287) -> Option < Option < Waiter < ' tcx > > > {
287288 if visited. contains ( & query. as_ptr ( ) ) {
288289 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>>,
321322#[ cfg( parallel_queries) ]
322323fn connected_to_root < ' tcx > (
323324 query : Lrc < QueryJob < ' tcx > > ,
324- visited : & mut HashSet < * const QueryJob < ' tcx > >
325+ visited : & mut FxHashSet < * const QueryJob < ' tcx > >
325326) -> bool {
326327 // We already visited this or we're deliberately ignoring it
327328 if visited. contains ( & query. as_ptr ( ) ) {
@@ -357,7 +358,7 @@ fn remove_cycle<'tcx>(
357358 wakelist : & mut Vec < Lrc < QueryWaiter < ' tcx > > > ,
358359 tcx : TyCtxt < ' _ , ' tcx , ' _ >
359360) -> bool {
360- let mut visited = HashSet :: new ( ) ;
361+ let mut visited = FxHashSet :: default ( ) ;
361362 let mut stack = Vec :: new ( ) ;
362363 // Look for a cycle starting with the last query in `jobs`
363364 if let Some ( waiter) = cycle_check ( jobs. pop ( ) . unwrap ( ) ,
@@ -389,7 +390,7 @@ fn remove_cycle<'tcx>(
389390 // connected to queries outside the cycle
390391 let entry_points: Vec < Lrc < QueryJob < ' tcx > > > = stack. iter ( ) . filter_map ( |query| {
391392 // 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| {
393394 if q. 1 . as_ptr ( ) != query. 1 . as_ptr ( ) {
394395 Some ( q. 1 . as_ptr ( ) )
395396 } else {
0 commit comments