-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Audit and handle remaining cases of rustc::potential_query_instability
lint (iterating HashMap
s)
#84447
Comments
#64131 added the |
The lint exists since #89558, and has allowed on all compiler crates as Steps, for each crate except
Please reach out on zulip if there are any questions. |
It seems like no one is assigned to this and I'd like to give it a try so assigning myself. @rustbot claim |
…etrochenkov remove allow(rustc::potential_query_instability) in rustc_span Also, avoid sorting before debug output as iteration order can now be relied upon. Related rust-lang#84447
…ompiler-errors rustc_expand: Switch FxHashMap to FxIndexMap where iteration is used Relates rust-lang#84447
I was hoping to get back to this after vacation but I haven't had the time and I likely won't in the near future. I've converted some of the modules to use the stable hash containers but there is a decent amount left so it is probably possible to have multiple people working on this, assuming some coordination. There are two outstanding PRs from me that I will finish up. The first is #99334 and seems ready to merge. Second one is #99065 which requires the @rustbot release-assignment |
…oli-obk rustc_error, rustc_private: Switch to stable hash containers Relates rust-lang#84447
rustc_error, rustc_private: Switch to stable hash containers Relates rust-lang/rust#84447
I'm gonna give this a try |
…instability_lint_for_rustc_metadata, r=compiler-errors Handle `rustc_metadata` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_metadata/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/lib.rs#L3) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447
…y-instability-lint-for-rustc-query-impl, r=compiler-errors Handle `rustc_query_impl` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_query_impl/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_query_impl/src/lib.rs#L5) <s>and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors</s> (was not necessary for this PR). A somewhat tracking issue: rust-lang#84447 r? ``@compiler-errors``
Rollup merge of rust-lang#131192 - ismailarilik:handle-potential-query-instability-lint-for-rustc-query-impl, r=compiler-errors Handle `rustc_query_impl` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_query_impl/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_query_impl/src/lib.rs#L5) <s>and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors</s> (was not necessary for this PR). A somewhat tracking issue: rust-lang#84447 r? ``@compiler-errors``
…ty_lint_for_rustc_metadata, r=compiler-errors Handle `rustc_metadata` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_metadata/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/lib.rs#L3) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang/rust#84447
…instability-lint-for-librustdoc, r=<try> Handle `librustdoc` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/librustdoc/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/lib.rs#L23) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
@cjgillot You specified BTW, with the PRs I recently opened, there is not much left to fix but I will open another PR for the remainings. |
The only thing that would be needed for |
…y-instability-lint-for-rustc-interface, r=cjgillot Handle `rustc_interface` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` occurrences from [`compiler/rustc_interface/`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_interface/) <s>and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors</s> (was not necessary for this PR). A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
Rollup merge of rust-lang#131280 - ismailarilik:handle-potential-query-instability-lint-for-rustc-interface, r=cjgillot Handle `rustc_interface` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` occurrences from [`compiler/rustc_interface/`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_interface/) <s>and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors</s> (was not necessary for this PR). A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
…instability-lint-for-librustdoc, r=notriddle Handle `librustdoc` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/librustdoc/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/lib.rs#L23) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
@cjgillot there is just one |
…instability-lint-for-librustdoc, r=notriddle Handle `librustdoc` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/librustdoc/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/lib.rs#L23) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
For migrated ones, perf might be improved by removing some |
…y-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447
…y-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447
…y-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447
Rollup merge of rust-lang#131277 - ismailarilik:handle-potential-query-instability-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447
…ty-lint-for-librustdoc, r=notriddle Handle `librustdoc` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/librustdoc/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/lib.rs#L23) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang/rust#84447 r? `@compiler-errors`
…lity-lint-for-clippy, r=xFrednet Handle `clippy` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang/rust#84447
…instability-lint-for-rustc-resolve, r=<try> Handle `rustc_resolve` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_resolve/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/lib.rs#L12) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
…instability-lint-for-rustc-resolve, r=<try> Handle `rustc_resolve` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_resolve/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/lib.rs#L12) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
…instability-lint-for-rustc-resolve, r=<try> Handle `rustc_resolve` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_resolve/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/lib.rs#L12) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: rust-lang#84447 r? `@compiler-errors`
The iteration order of a
HashMap
depends on theHash
value of the keys. In rustc, theHash
value of a key can change between compilation sessions, even if theHashStable
value remains the same (e.g.DefId
,Symbol
, etc.). This means that iterating over aHashMap
can cause a query to produce different results given the same (as determined byHashStable
) input. This can be quite subtle, as demonstrated by #82272 (comment)To eliminate this source of issues, we should make an internal rustc-only lint for iterating over a
HashMap
in any way. This will need to cover explicit method calls (e.g..keys()
and.values()
), as well as any usage of theIntoIterator
impl forHashMap
.Note that we don't want to ban the usage of
HashMap
s with unstable keys - as long as they're only used for lookup (and not iteration), it's much more efficient than repeatedly converting to the stable form of a key (e.g.DefId
->DefPathHash
orSymbol
->String
).The text was updated successfully, but these errors were encountered: