diff options
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 8 |
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()), } } |
