Skip to content

Commit c19eb9a

Browse files
committed
Auto merge of #154576 - Zalathar:cache-on-disk, r=nnethercote
Simplify the `cache_on_disk_if` modifier to just `cache_on_disk` Thanks to rust-lang/rust#154304, there is now only one remaining query with a non-trivial cache-on-disk condition (`check_liveness`). But prior experiments at rust-lang/rust#153441 (comment) indicate that `check_liveness` can also be made non-disk-caching with little or no measurable effect. This PR takes advantage of those facts to replace the `cache_on_disk_if` modifier with a simpler `cache_on_disk` modifier: - When combined with `separate_provide_extern`, only values for “local” keys are cached to disk. - For any other query with `cache_on_disk`, values are cached to disk unconditionally. r? nnethercote (or compiler)
2 parents e2d3405 + a098043 commit c19eb9a

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/queries/incremental-compilation-in-detail.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ respect to incremental compilation:
479479
and the projection queries act as a "firewall", shielding their dependents
480480
from the unconditionally red `no_hash` node.
481481

482-
- `cache_on_disk_if` - This attribute is what determines which query results
483-
are persisted in the incremental compilation query result cache.
484-
The attribute takes an expression that allows per query invocation decisions.
485-
For example, it makes no sense to store values from upstream
486-
crates in the cache because they are already available in the upstream crate's metadata.
482+
- `cache_on_disk` - The query's return values are cached to disk, and can be
483+
loaded by subsequent sessions if the corresponding dep node is green.
484+
If the `separate_provide_extern` modifier is also present, values will only
485+
be cached to disk for "local" keys, because values for external crates should
486+
be loadable from crate metadata instead.
487487

488488
[mod]: ../query.html#adding-a-new-kind-of-query
489489

src/query.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ This looks something like:
275275
rustc_queries! {
276276
/// Records the type of every item.
277277
query type_of(key: DefId) -> Ty<'tcx> {
278-
cache_on_disk_if { key.is_local() }
279278
desc { |tcx| "computing the type of `{}`", tcx.def_path_str(key) }
279+
cache_on_disk
280+
separate_provide_extern
280281
}
281282
...
282283
}

0 commit comments

Comments
 (0)