Assert redundant incremental check#156599
Open
zetanumbers wants to merge 1 commit into
Open
Conversation
Collaborator
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
Author
|
I think we can clarify this change with a comment or by outright inlining that function. Not sure what to pick tho. |
Contributor
Author
|
Also that check is covered by tests, so I making it unconditionally panic would trigger following incremental tests failures:
|
Contributor
Author
|
I think we could change it to debug_assert and check if perf is affected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So to incrementally execute
tcx.ensure_done().query()we first do query graph coloring to determine if nothing has changed and maybe color our query green. In that case forensure_okwe skip further execution and return. However forensure_donewe do this check:rust/compiler/rustc_query_impl/src/execution.rs
Lines 601 to 608 in 7c3c88f
Which in turn looks up a serialized query value:
rust/compiler/rustc_middle/src/query/on_disk_cache.rs
Lines 338 to 343 in 7c3c88f
However, we only serialize query values if the pure (I've checked) function
will_cache_on_disk_for_key_fnfrom above returns true:rust/compiler/rustc_query_impl/src/plumbing.rs
Lines 95 to 99 in 7c3c88f
As such
loadable_from_diskshould be able to simply check iftcx.query_system.on_disk_cacheis loaded and assume query value is present, assuming thatwill_cache_on_disk_for_key_fnreturned true.