incr. comp.: Access span information more carefully throughout the compiler. #43088
Labels
A-incr-comp
Area: Incremental compilation
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
I-compiletime
Issue: Problems and improvements with respect to compile times.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Currently span information is accessed and copied rather haphazardly throughout the compiler which introduces lots of "false" dependency edges, because the span information is then never used or just used for error reporting. A few examples are:
def_span
of the type in questions, just to throw it away again immediately.I'm sure there are many other examples. Since spans are inherently unstable (adding a new-line somewhere will change all subsequent spans within the same file) this is a problem.
One possible solution would be to not store spans directly in the HIR and MIR (and other places) anymore but in a side-table that is part of the HIR map. Instead of a
Span
one would use and pass around aSpanId
(which can just be a newtypedHirId
orNodeId
). Only when theSpanId
is resolved to an actualSpan
, would we register a dependency on the thing the span originated from.cc @nikomatsakis
The text was updated successfully, but these errors were encountered: