diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-06 14:49:08 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-06 14:49:08 +0530 |
| commit | 707c0d9a2d37da38b21222cd4b98e10a93a2643d (patch) | |
| tree | 5af601bf9937d776f4aa45b772568abfee3ae745 /compiler/rustc_query_impl | |
| parent | 5b8cf49c51833ee5d27ae2e8e179337dbb9f14d7 (diff) | |
| parent | 31629860e8bada8156c207b77b91901fc274acf7 (diff) | |
| download | rust-707c0d9a2d37da38b21222cd4b98e10a93a2643d.tar.gz rust-707c0d9a2d37da38b21222cd4b98e10a93a2643d.zip | |
Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-dead
Only compute DefKind through the query.
Diffstat (limited to 'compiler/rustc_query_impl')
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 307ad4e844b..3ed6632ba66 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -282,11 +282,14 @@ macro_rules! define_queries { } else { Some(key.default_span(*tcx)) }; - // Use `tcx.hir().opt_def_kind()` to reduce the chance of - // accidentally triggering an infinite query loop. - let def_kind = key.key_as_def_id() - .and_then(|def_id| def_id.as_local()) - .and_then(|def_id| tcx.hir().opt_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() + .and_then(|def_id| def_id.as_local()) + .and_then(|def_id| tcx.opt_def_kind(def_id)) + }; let hash = || { let mut hcx = tcx.create_stable_hashing_context(); let mut hasher = StableHasher::new(); |
