Open
Description
This is mostly just a rustc developer experience issue that crops up if you accidentally introduce a query cycle before ast lowering completes. After this happened to me a few times, I finally understand what is happening so I figured I should document it.
If a query cycle occurs before or during ast lowering, then rustc winds up querying for the HIR while trying to collect info about the cycle to report it, and this leads to another cycle and more panics, which is rather confusing to behold. The root issue is that we try to call the def_span
and def_kind
queries in the following places:
(default_span
is implemented using def_span
if the key is DefId
or LocalDefId
)
Some ideas:
- Use
source_span
instead ofdef_span
- Add a way to get
def_span
and/ordef_kind
from AST (probably only for diagnostics cases like this) - Add a way to detect if AST has been lowered, and skip those queries if not
Metadata
Metadata
Assignees
Labels
Area: Makes things more difficult for new or seasoned contributors to RustArea: Compiler frontend (errors, parsing and HIR)Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)Category: An issue proposing an enhancement or a PR with one.Relevant to the compiler team, which will review and decide on the PR/issue.