[incremental] Isolate the "used trait imports" part of typeck tables into a distinct query #45214
Labels
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-incr-comp
Working group: Incremental compilation
As part of #45208, one place where
typeck_tables_of
is used that cannot easily be removed is this call fromcheck_unused
. What this code is doing is aggregating the set of trait imports that are used by all the function bodies in the crate. Due to glob imports and the like, it is hard to isolate which function body may make use of which trait import. Also, this information is only available from type-checking. So this will require serializing some amount of incremental data in between sessions. But since we don't want to save all of the typeck data, we can at least minimize the amount of data.The idea is to introduce a new intermediate query
used_trait_imports(D)
for some def-id D. It will have the return typeRc<DefIdSet>
and will return theused_trait_imports
field fromtypeck_tables_of(D)
.The steps are as follows:
used_trait_imports
to beRc<DefIdSet>
so it can be cheaply cloned. Make the code compiled.used_trait_imports
query as defined above; it should returntcx.typeck_tables_of(key).used_trait_imports.clone()
.typeck_tables_of
.The text was updated successfully, but these errors were encountered: