@@ -290,7 +290,7 @@ fn cycle_check<'tcx>(query: Lrc<QueryJob<'tcx>>,
290290 stack : & mut Vec < ( Span , Lrc < QueryJob < ' tcx > > ) > ,
291291 visited : & mut FxHashSet < * const QueryJob < ' tcx > >
292292) -> Option < Option < Waiter < ' tcx > > > {
293- if visited. contains ( & query. as_ptr ( ) ) {
293+ if ! visited. insert ( query. as_ptr ( ) ) {
294294 return if let Some ( p) = stack. iter ( ) . position ( |q| q. 1 . as_ptr ( ) == query. as_ptr ( ) ) {
295295 // We detected a query cycle, fix up the initial span and return Some
296296
@@ -304,8 +304,7 @@ fn cycle_check<'tcx>(query: Lrc<QueryJob<'tcx>>,
304304 }
305305 }
306306
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
309308 stack. push ( ( span, query. clone ( ) ) ) ;
310309
311310 // Visit all the waiters
@@ -330,7 +329,7 @@ fn connected_to_root<'tcx>(
330329 visited : & mut FxHashSet < * const QueryJob < ' tcx > >
331330) -> bool {
332331 // We already visited this or we're deliberately ignoring it
333- if visited. contains ( & query. as_ptr ( ) ) {
332+ if ! visited. insert ( query. as_ptr ( ) ) {
334333 return false ;
335334 }
336335
@@ -339,8 +338,6 @@ fn connected_to_root<'tcx>(
339338 return true ;
340339 }
341340
342- visited. insert ( query. as_ptr ( ) ) ;
343-
344341 visit_waiters ( query, |_, successor| {
345342 if connected_to_root ( successor, visited) {
346343 Some ( None )
0 commit comments