File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
compiler/rustc_query_impl/src Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -287,11 +287,14 @@ macro_rules! define_queries {
287287 } else {
288288 Some ( key. default_span( * tcx) )
289289 } ;
290- // Use `tcx.hir().opt_def_kind()` to reduce the chance of
291- // accidentally triggering an infinite query loop.
292- let def_kind = key. key_as_def_id( )
293- . and_then( |def_id| def_id. as_local( ) )
294- . map( |def_id| tcx. def_kind( def_id) ) ;
290+ let def_kind = if kind == dep_graph:: DepKind :: opt_def_kind {
291+ // Try to avoid infinite recursion.
292+ None
293+ } else {
294+ key. key_as_def_id( )
295+ . and_then( |def_id| def_id. as_local( ) )
296+ . and_then( |def_id| tcx. opt_def_kind( def_id) )
297+ } ;
295298 let hash = || {
296299 let mut hcx = tcx. create_stable_hashing_context( ) ;
297300 let mut hasher = StableHasher :: new( ) ;
You can’t perform that action at this time.
0 commit comments