-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Do not implement HashStable for HashSet (MCP 533) #108312
Do not implement HashStable for HashSet (MCP 533) #108312
Conversation
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in src/tools/clippy cc @rust-lang/clippy The Miri subtree was changed cc @rust-lang/miri |
Let's make sure this doesn't affect performance: |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 32266bc9e136e8565aaafa65a1ec90fe74972d9c with merge 2f0c248d7e9de8fbc0a7a26aa2c552ee88ba0389... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (2f0c248d7e9de8fbc0a7a26aa2c552ee88ba0389): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
tcx.arena.alloc_from_iter( | ||
// This is based on: | ||
// https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L62-L63 | ||
// https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L174 | ||
tcx.reachable_set(()).iter().filter_map(|&local_def_id| { | ||
reachable_set.into_iter().filter_map(|&local_def_id| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place where additional sorting is happening is in Miri's override implementation of the exported_symbols query.
This was copied from elsewhere in rustc (specifically reachable_non_generics_provider
), so if the change only happens in Miri but not the source where we copied this from, that seems suspicious?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type of reachable_non_generics_provider is a DefIdMap
, i.e. a type that does not have a visible iteration order, so no sorting needs to happen there.
rustc's version of exported_symbols
already does some stable sorting before returning the slice, so that is fine too. That Miri didn't sort the slice before returning could be considered a bug because queries must be deterministic across compilation sessions (and the iteration order of a HashSet of DefId/DefIndex/LocalDefId isn't). It's unlikely that this can cause a problem if incremental compilation isn't involved though.
…gnored_derived_traits query.
32266bc
to
b79f026
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9b60e6c): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
…table, r=eholk Do not implement HashStable for HashSet (MCP 533) This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](rust-lang/compiler-team#533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order. The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
This PR removes all occurrences of
HashSet
in query results, replacing it either withFxIndexSet
or withUnordSet
, and then removes theHashStable
implementation ofHashSet
. This is part of implementing MCP 533, that is, removing theHashStable
implementations of all collection types with unstable iteration order.The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the
exported_symbols
query.