[incremental] introduce ensure()
operation
#45210
Labels
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, we would like to introduce a first-class
ensure()
operation. InvokingQ::ensure(K)
for some queryQ
with keyK
is semantically equivalent to introducing a fresh queryQ1
that has a return type of unit and a provider like:In other words, it executes the query
Q
but does not use the result. This is worthwhile because it avoids the need to load the result from disk (or execute the provider, if we are not storing the results of Q to disk).In order to introduce
ensure()
, we want to modify the plumbing macros for the query infrastructure. I think we could add an accessor calledensure
, somewhat liketry_get
. It would look something like this:Next, just to use this function somewhere, we can convert the code in
librustc_typeck
to useensure
. Notably, change this line fromself.tcx.typeck_tables_of(body_owner_def_id)
toty::maps::queries::typeck_tables_of::ensure(self.tcx, body_owner_def_id)
.(This last step is not enough to skip type-checking, since there are other uses of
typeck_tables_of
, but it's a necessary precondition.)The text was updated successfully, but these errors were encountered: