diff options
| author | bors <bors@rust-lang.org> | 2023-03-08 06:07:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-08 06:07:11 +0000 |
| commit | 9b60e6c68ff0aabad9a0edd71898466886dbf6bb (patch) | |
| tree | fba306d7556866ebf4c1a1504a59be89e92f1030 /src | |
| parent | 38b96553112dce3de630890701f17d86e265f6ba (diff) | |
| parent | b79f0261f87ff38de6fee6a6f6ce9915a8f0e6b4 (diff) | |
| download | rust-9b60e6c68ff0aabad9a0edd71898466886dbf6bb.tar.gz rust-9b60e6c68ff0aabad9a0edd71898466886dbf6bb.zip | |
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](https://github.com/rust-lang/compiler-team/issues/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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/wildcard_imports.rs | 10 | ||||
| -rw-r--r-- | src/tools/miri/src/bin/miri.rs | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/tools/clippy/clippy_lints/src/wildcard_imports.rs b/src/tools/clippy/clippy_lints/src/wildcard_imports.rs index e4d1ee195c4..e105452e1c5 100644 --- a/src/tools/clippy/clippy_lints/src/wildcard_imports.rs +++ b/src/tools/clippy/clippy_lints/src/wildcard_imports.rs @@ -155,14 +155,10 @@ impl LateLintPass<'_> for WildcardImports { ) }; - let imports_string = if used_imports.len() == 1 { - used_imports.iter().next().unwrap().to_string() + let mut imports = used_imports.items().map(ToString::to_string).into_sorted_stable_ord(false); + let imports_string = if imports.len() == 1 { + imports.pop().unwrap() } else { - let mut imports = used_imports - .iter() - .map(ToString::to_string) - .collect::<Vec<_>>(); - imports.sort(); if braced_glob { imports.join(", ") } else { diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index c0267956aab..a2caeb97297 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -109,11 +109,14 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls { // an empty result if `tcx.sess.opts.output_types.should_codegen()` is false. local_providers.exported_symbols = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); + let reachable_set = tcx.with_stable_hashing_context(|hcx| { + tcx.reachable_set(()).to_sorted(&hcx, true) + }); 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| { // Do the same filtering that rustc does: // https://github.com/rust-lang/rust/blob/2962e7c0089d5c136f4e9600b7abccfbbde4973d/compiler/rustc_codegen_ssa/src/back/symbol_export.rs#L84-L102 // Otherwise it may cause unexpected behaviours and ICEs |
