We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3d6320 commit 974b1e3Copy full SHA for 974b1e3
compiler/rustc_query_impl/src/plumbing.rs
@@ -287,11 +287,14 @@ macro_rules! define_queries {
287
} else {
288
Some(key.default_span(*tcx))
289
};
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));
+ let def_kind = if kind == dep_graph::DepKind::opt_def_kind {
+ // Try to avoid infinite recursion.
+ None
+ } else {
+ 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
+ };
298
let hash = || {
299
let mut hcx = tcx.create_stable_hashing_context();
300
let mut hasher = StableHasher::new();
0 commit comments