Eliminate QueryLatchInfo.#153689
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Mar 11, 2026
Merged
Conversation
The boolean `complete` flag indicates whether the `waiters` vec is still in use, which means the `waiters` vec must be empty when `complete` is true. This is achieved by using `drain` on the waiters just after `complete` is set. We can do better by using the type system to make invalid combinations impossible. This commit removes `complete` and puts the waiters inside an `Option`. `Some` means the query job is still active, and `None` once it is complete. And `QueryLatchInfo` is eliminated. (The `Arc<Mutex<Option<Vec<Arc<QueryWaiter<'tcx>>>>>>` type is a mouthful, but when it's all in one place I find it easier to understand than when it's split across two types. And we can use `Option` methods like `as_ref`, `as_mut`, and `take`, which is nice.)
Contributor
Author
|
This is a follow-up to #153595. |
Contributor
|
@bors r+ rollup |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 11, 2026
…uwer Rollup of 4 pull requests Successful merges: - #153072 (Allow merging all libcore/alloc doctests into a single binary) - #153408 (miri: make read_discriminant UB when the tag is not in the validity range of the tag field) - #153674 (Detect inherent method behind deref being shadowed by trait method) - #153689 (Eliminate `QueryLatchInfo`.)
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Mar 12, 2026
…uwer Rollup of 4 pull requests Successful merges: - rust-lang/rust#153072 (Allow merging all libcore/alloc doctests into a single binary) - rust-lang/rust#153408 (miri: make read_discriminant UB when the tag is not in the validity range of the tag field) - rust-lang/rust#153674 (Detect inherent method behind deref being shadowed by trait method) - rust-lang/rust#153689 (Eliminate `QueryLatchInfo`.)
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.
The boolean
completeflag indicates whether thewaitersvec is still in use, which means thewaitersvec must be empty whencompleteis true. This is achieved by usingdrainon the waiters just aftercompleteis set.We can do better by using the type system to make invalid combinations impossible. This commit removes
completeand puts the waiters inside anOption.Somemeans the query job is still active, andNoneonce it is complete. AndQueryLatchInfois eliminated.(The
Arc<Mutex<Option<Vec<Arc<QueryWaiter<'tcx>>>>>>type is a mouthful, but when it's all in one place I find it easier to understand than when it's split across two types. And we can useOptionmethods likeas_ref,as_mut, andtake, which is nice.)r? @petrochenkov