@@ -290,7 +290,7 @@ fn cycle_check<'tcx>(query: Lrc<QueryJob<'tcx>>,
290
290
stack : & mut Vec < ( Span , Lrc < QueryJob < ' tcx > > ) > ,
291
291
visited : & mut FxHashSet < * const QueryJob < ' tcx > >
292
292
) -> Option < Option < Waiter < ' tcx > > > {
293
- if visited. contains ( & query. as_ptr ( ) ) {
293
+ if ! visited. insert ( query. as_ptr ( ) ) {
294
294
return if let Some ( p) = stack. iter ( ) . position ( |q| q. 1 . as_ptr ( ) == query. as_ptr ( ) ) {
295
295
// We detected a query cycle, fix up the initial span and return Some
296
296
@@ -304,8 +304,7 @@ fn cycle_check<'tcx>(query: Lrc<QueryJob<'tcx>>,
304
304
}
305
305
}
306
306
307
- // Mark this query is visited and add it to the stack
308
- visited. insert ( query. as_ptr ( ) ) ;
307
+ // Query marked as visited is added it to the stack
309
308
stack. push ( ( span, query. clone ( ) ) ) ;
310
309
311
310
// Visit all the waiters
@@ -330,7 +329,7 @@ fn connected_to_root<'tcx>(
330
329
visited : & mut FxHashSet < * const QueryJob < ' tcx > >
331
330
) -> bool {
332
331
// We already visited this or we're deliberately ignoring it
333
- if visited. contains ( & query. as_ptr ( ) ) {
332
+ if ! visited. insert ( query. as_ptr ( ) ) {
334
333
return false ;
335
334
}
336
335
@@ -339,8 +338,6 @@ fn connected_to_root<'tcx>(
339
338
return true ;
340
339
}
341
340
342
- visited. insert ( query. as_ptr ( ) ) ;
343
-
344
341
visit_waiters ( query, |_, successor| {
345
342
if connected_to_root ( successor, visited) {
346
343
Some ( None )
0 commit comments