1
Fork 0

Rollup merge of #108533 - notriddle:notriddle/resolver-def-descr, r=compiler-errors

diagnostics: avoid querying `associated_item` in the resolver

Fixes #108529

CC #108324
This commit is contained in:
Matthias Krüger 2023-02-27 18:48:51 +01:00 committed by GitHub
commit a184150247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View file

@ -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()),
}
}