Skip to content

Commit 562e190

Browse files
committed
Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, 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.
2 parents c6ad95a + bd85a17 commit 562e190

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bin/miri.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,14 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
109109
// an empty result if `tcx.sess.opts.output_types.should_codegen()` is false.
110110
local_providers.exported_symbols = |tcx, cnum| {
111111
assert_eq!(cnum, LOCAL_CRATE);
112+
let reachable_set = tcx.with_stable_hashing_context(|hcx| {
113+
tcx.reachable_set(()).to_sorted(&hcx, true)
114+
});
112115
tcx.arena.alloc_from_iter(
113116
// This is based on:
114117
// https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L62-L63
115118
// https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L174
116-
tcx.reachable_set(()).iter().filter_map(|&local_def_id| {
119+
reachable_set.into_iter().filter_map(|&local_def_id| {
117120
// Do the same filtering that rustc does:
118121
// https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L84-L102
119122
// Otherwise it may cause unexpected behaviours and ICEs

0 commit comments

Comments
 (0)