Query cycle before ast lowered turns into dumpster fire #103844
Labels
A-contributor-roadblock
Area: Makes things more difficult for new contributors to rust itself
A-frontend
Area: Compiler frontend (errors, parsing and HIR)
A-query-system
Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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
anddef_kind
queries in the following places:rust/compiler/rustc_query_impl/src/plumbing.rs
Line 319 in e70cbef
(
default_span
is implemented usingdef_span
if the key isDefId
orLocalDefId
)rust/compiler/rustc_query_impl/src/plumbing.rs
Line 326 in e70cbef
Some ideas:
source_span
instead ofdef_span
def_span
and/ordef_kind
from AST (probably only for diagnostics cases like this)The text was updated successfully, but these errors were encountered: