-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Handle rustc_query_system
cases of rustc::potential_query_instability
lint
#131200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Handle rustc_query_system
cases of rustc::potential_query_instability
lint
#131200
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@rustbot author |
062a42c
to
1c33630
Compare
1c33630
to
f34e703
Compare
@rustbot review |
Could you point to the place where each of these maps is iterated over? |
error: using `iter` can result in unstable query results
--> compiler/rustc_query_system/src/dep_graph/graph.rs:1392:44
|
1392 | if let Some((node, _)) = shard.iter().find(|(_, index)| **index == dep_node_index) {
| ^^^^
|
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
= note: `-D rustc::potential-query-instability` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(rustc::potential_query_instability)]`
error: using `values` can result in unstable query results
--> compiler/rustc_query_system/src/dep_graph/serialized.rs:654:50
|
654 | let mut stats: Vec<_> = record_stats.values().collect();
| ^^^^^^
|
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
error: using `iter` can result in unstable query results
--> compiler/rustc_query_system/src/query/plumbing.rs:80:34
|
80 | for (k, v) in shard?.iter() {
| ^^^^
|
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
error: using `keys` can result in unstable query results
--> compiler/rustc_query_system/src/query/job.rs:517:47
|
517 | let mut jobs: Vec<QueryJobId> = query_map.keys().cloned().collect();
| ^^^^
|
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
error: using `iter` can result in unstable query results
--> compiler/rustc_query_system/src/query/caches.rs:62:33
|
62 | for (k, v) in shard.iter() {
| ^^^^
|
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale |
@ismailarilik that's not very helpful. The point is chosing for each map, what is the best course of action, between changing the type, and allowing the lint because the non-determinism does not show. For instance, at |
Addressed here: 870d7c2 |
In |
☔ The latest upstream changes (presumably #132282) made this pull request unmergeable. Please resolve the merge conflicts. |
r? compiler |
I am not sure if this PR is completely justified. For example, as far as I checked, the To move this forward I'd recommend opening a Zulip thread in t-compiler to get a wider attention for this. Since I have limited experience in the query system, r? compiler |
Passing the review on to somebody who knows more about these data structures than me. |
Current state (I think largely matching what was reported before):
Per #131200 (comment) this is OK, there's only ever one node result possible so this is deterministic. This is in code that's going to panic immediately afterwards anyway so it doesn't really matter what we do here.
This is just stat-dumping code that can't have any effect on query stability. So also fine.
This I'm less sure about -- @Zoxc is maybe most familiar with our cycle-breaking code, I seem to recall some recent work on that for parallel compilation as well? I think the next step here is to either open a new PR or rebase this one, but not doing any structure modifications, just allowing the lints for all three cases with a FIXME comment on the 3rd one unless we hear otherwise from someone with more knowledge. |
Generally this lint doesn't apply to
In theory it's possible for query code to inspect cycle errors via |
This PR removes
#![allow(rustc::potential_query_instability)]
line fromcompiler/rustc_query_system/src/lib.rs
and convertsFxHash{Map,Set}
types intoFxIndex{Map,Set}
to suppress lint errors.A somewhat tracking issue: #84447
r? @compiler-errors