Skip to content

Commit 0e93419

Browse files
Make iteration order of upstream_monomorphizations query stable
1 parent 138cfab commit 0e93419

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::base::allocator_kind_for_codegen;
33
use std::collections::hash_map::Entry::*;
44

55
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE};
6-
use rustc_data_structures::fx::FxHashMap;
6+
use rustc_data_structures::unord::UnordMap;
77
use rustc_hir::def::DefKind;
88
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
99
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -393,10 +393,10 @@ fn exported_symbols_provider_local(
393393
fn upstream_monomorphizations_provider(
394394
tcx: TyCtxt<'_>,
395395
(): (),
396-
) -> DefIdMap<FxHashMap<GenericArgsRef<'_>, CrateNum>> {
396+
) -> DefIdMap<UnordMap<GenericArgsRef<'_>, CrateNum>> {
397397
let cnums = tcx.crates(());
398398

399-
let mut instances: DefIdMap<FxHashMap<_, _>> = Default::default();
399+
let mut instances: DefIdMap<UnordMap<_, _>> = Default::default();
400400

401401
let drop_in_place_fn_def_id = tcx.lang_items().drop_in_place_fn();
402402

@@ -445,7 +445,7 @@ fn upstream_monomorphizations_provider(
445445
fn upstream_monomorphizations_for_provider(
446446
tcx: TyCtxt<'_>,
447447
def_id: DefId,
448-
) -> Option<&FxHashMap<GenericArgsRef<'_>, CrateNum>> {
448+
) -> Option<&UnordMap<GenericArgsRef<'_>, CrateNum>> {
449449
debug_assert!(!def_id.is_local());
450450
tcx.upstream_monomorphizations(()).get(&def_id)
451451
}

compiler/rustc_middle/src/query/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ rustc_queries! {
15421542
/// added or removed in any upstream crate. Instead use the narrower
15431543
/// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
15441544
/// better, `Instance::upstream_monomorphization()`.
1545-
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<FxHashMap<GenericArgsRef<'tcx>, CrateNum>> {
1545+
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
15461546
arena_cache
15471547
desc { "collecting available upstream monomorphizations" }
15481548
}
@@ -1555,7 +1555,7 @@ rustc_queries! {
15551555
/// You likely want to call `Instance::upstream_monomorphization()`
15561556
/// instead of invoking this query directly.
15571557
query upstream_monomorphizations_for(def_id: DefId)
1558-
-> Option<&'tcx FxHashMap<GenericArgsRef<'tcx>, CrateNum>>
1558+
-> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
15591559
{
15601560
desc { |tcx|
15611561
"collecting available upstream monomorphizations for `{}`",

0 commit comments

Comments
 (0)