Handle rustc_query_system cases of rustc::potential_query_instability lint#131200
Handle rustc_query_system cases of rustc::potential_query_instability lint#131200bors merged 1 commit intorust-lang:masterfrom ismailarilik:handle-potential-query-instability-lint-for-rustc-query_system
rustc_query_system cases of rustc::potential_query_instability lint#131200Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
@rustbot author |
|
@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 |
|
@rustbot review |
|
I think this PR can close #84447 since other usages of |
|
☔ The latest upstream changes (presumably #139758) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #140887) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#131200 (Handle `rustc_query_system` cases of `rustc::potential_query_instability` lint) - rust-lang#141244 (windows: document that we rely on an undocumented property of GetUserProfileDirectoryW) - rust-lang#141247 (skip compiler tools sanity checks on certain commands) - rust-lang#141248 (fix data race in ReentrantLock fallback for targets without 64bit atomics) - rust-lang#141249 (introduce common macro for `MutVisitor` and `Visitor` to dedup code) - rust-lang#141253 (Warning added when dependency crate has async drop types, and the feature is disabled) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131200 - ismailarilik:handle-potential-query-instability-lint-for-rustc-query_system, r=fee1-dead Handle `rustc_query_system` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_query_system/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_query_system/src/lib.rs#L2) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
This PR removes
#![allow(rustc::potential_query_instability)]line fromcompiler/rustc_query_system/src/lib.rsand convertsFxHash{Map,Set}types intoFxIndex{Map,Set}to suppress lint errors.A somewhat tracking issue: #84447
r? @compiler-errors