File tree Expand file tree Collapse file tree
compiler/rustc_query_impl/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -327,21 +327,23 @@ pub(crate) fn create_query_frame<
327327 description
328328 } ;
329329
330- let span = if kind == dep_graph :: dep_kinds :: def_span || reduce_queries {
330+ let span = if reduce_queries {
331331 // The `def_span` query is used to calculate `default_span`,
332332 // so exit to avoid infinite recursion.
333333 None
334334 } else {
335- Some ( key. default_span ( tcx) )
335+ Some ( tcx . with_reduced_queries ( || key. default_span ( tcx) ) )
336336 } ;
337337
338338 let def_id = key. key_as_def_id ( ) ;
339339
340- let def_kind = if kind == dep_graph :: dep_kinds :: def_kind || reduce_queries {
340+ let def_kind = if reduce_queries {
341341 // Try to avoid infinite recursion.
342342 None
343343 } else {
344- def_id. and_then ( |def_id| def_id. as_local ( ) ) . map ( |def_id| tcx. def_kind ( def_id) )
344+ def_id
345+ . and_then ( |def_id| def_id. as_local ( ) )
346+ . map ( |def_id| tcx. with_reduced_queries ( || tcx. def_kind ( def_id) ) )
345347 } ;
346348
347349 let def_id_for_ty_in_cycle = key. def_id_for_ty_in_cycle ( ) ;
Original file line number Diff line number Diff line change 1- //~ ERROR: cycle detected when looking up span for `Default`
1+ //~ ERROR: cycle detected when getting HIR ID of `Default`
22trait Default {
33 type Id ;
44
Original file line number Diff line number Diff line change 1- error[E0391]: cycle detected when looking up span for `Default`
1+ error[E0391]: cycle detected when getting HIR ID of `Default`
22 |
3- = note: ...which immediately requires looking up span for `Default` again
4- = note: cycle used when perform lints prior to AST lowering
3+ = note: ...which requires getting the crate HIR...
4+ = note: ...which requires perform lints prior to AST lowering...
5+ = note: ...which requires looking up span for `Default`...
6+ = note: ...which again requires getting HIR ID of `Default`, completing the cycle
7+ = note: cycle used when getting the resolver for lowering
58 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
69
710error: aborting due to 1 previous error
You can’t perform that action at this time.
0 commit comments