about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-27 18:48:51 +0100
committerGitHub <noreply@github.com>2023-02-27 18:48:51 +0100
commita184150247298c98edd445d241ef487e197c91a9 (patch)
tree0ef12dd8679cca8e65e6b9bb14bd578f4e145058 /compiler/rustc_resolve/src
parent828b66e6de8c8b0aaf33bf971d36bd6de75cd7ca (diff)
parentf058bb0fcfeef3ebb0da19b2399f575c3aa9c3e8 (diff)
downloadrust-a184150247298c98edd445d241ef487e197c91a9.tar.gz
rust-a184150247298c98edd445d241ef487e197c91a9.zip
Rollup merge of #108533 - notriddle:notriddle/resolver-def-descr, r=compiler-errors
diagnostics: avoid querying `associated_item` in the resolver

Fixes #108529

CC #108324
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index ee2d2301399..7add59ac627 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -189,7 +189,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         }
 
         let container = match parent.kind {
-            ModuleKind::Def(kind, _, _) => self.tcx.def_kind_descr(kind, parent.def_id()),
+            // Avoid using TyCtxt::def_kind_descr in the resolver, because it
+            // indirectly *calls* the resolver, and would cause a query cycle.
+            ModuleKind::Def(kind, _, _) => kind.descr(parent.def_id()),
             ModuleKind::Block => "block",
         };
 
@@ -1804,7 +1806,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                         found("module")
                     } else {
                         match binding.res() {
-                            Res::Def(kind, id) => found(self.tcx.def_kind_descr(kind, id)),
+                            // Avoid using TyCtxt::def_kind_descr in the resolver, because it
+                            // indirectly *calls* the resolver, and would cause a query cycle.
+                            Res::Def(kind, id) => found(kind.descr(id)),
                             _ => found(ns_to_try.descr()),
                         }
                     }