Make iteration order of upstream_monomorphizations query stable
This commit is contained in:
parent
138cfab9f7
commit
0e934190fd
@ -3,7 +3,7 @@ use crate::base::allocator_kind_for_codegen;
|
|||||||
use std::collections::hash_map::Entry::*;
|
use std::collections::hash_map::Entry::*;
|
||||||
|
|
||||||
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE};
|
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::unord::UnordMap;
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
|
||||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||||
@ -393,10 +393,10 @@ fn exported_symbols_provider_local(
|
|||||||
fn upstream_monomorphizations_provider(
|
fn upstream_monomorphizations_provider(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
(): (),
|
(): (),
|
||||||
) -> DefIdMap<FxHashMap<GenericArgsRef<'_>, CrateNum>> {
|
) -> DefIdMap<UnordMap<GenericArgsRef<'_>, CrateNum>> {
|
||||||
let cnums = tcx.crates(());
|
let cnums = tcx.crates(());
|
||||||
|
|
||||||
let mut instances: DefIdMap<FxHashMap<_, _>> = Default::default();
|
let mut instances: DefIdMap<UnordMap<_, _>> = Default::default();
|
||||||
|
|
||||||
let drop_in_place_fn_def_id = tcx.lang_items().drop_in_place_fn();
|
let drop_in_place_fn_def_id = tcx.lang_items().drop_in_place_fn();
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ fn upstream_monomorphizations_provider(
|
|||||||
fn upstream_monomorphizations_for_provider(
|
fn upstream_monomorphizations_for_provider(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> Option<&FxHashMap<GenericArgsRef<'_>, CrateNum>> {
|
) -> Option<&UnordMap<GenericArgsRef<'_>, CrateNum>> {
|
||||||
debug_assert!(!def_id.is_local());
|
debug_assert!(!def_id.is_local());
|
||||||
tcx.upstream_monomorphizations(()).get(&def_id)
|
tcx.upstream_monomorphizations(()).get(&def_id)
|
||||||
}
|
}
|
||||||
|
@ -1542,7 +1542,7 @@ rustc_queries! {
|
|||||||
/// added or removed in any upstream crate. Instead use the narrower
|
/// added or removed in any upstream crate. Instead use the narrower
|
||||||
/// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
|
/// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
|
||||||
/// better, `Instance::upstream_monomorphization()`.
|
/// better, `Instance::upstream_monomorphization()`.
|
||||||
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<FxHashMap<GenericArgsRef<'tcx>, CrateNum>> {
|
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<UnordMap<GenericArgsRef<'tcx>, CrateNum>> {
|
||||||
arena_cache
|
arena_cache
|
||||||
desc { "collecting available upstream monomorphizations" }
|
desc { "collecting available upstream monomorphizations" }
|
||||||
}
|
}
|
||||||
@ -1555,7 +1555,7 @@ rustc_queries! {
|
|||||||
/// You likely want to call `Instance::upstream_monomorphization()`
|
/// You likely want to call `Instance::upstream_monomorphization()`
|
||||||
/// instead of invoking this query directly.
|
/// instead of invoking this query directly.
|
||||||
query upstream_monomorphizations_for(def_id: DefId)
|
query upstream_monomorphizations_for(def_id: DefId)
|
||||||
-> Option<&'tcx FxHashMap<GenericArgsRef<'tcx>, CrateNum>>
|
-> Option<&'tcx UnordMap<GenericArgsRef<'tcx>, CrateNum>>
|
||||||
{
|
{
|
||||||
desc { |tcx|
|
desc { |tcx|
|
||||||
"collecting available upstream monomorphizations for `{}`",
|
"collecting available upstream monomorphizations for `{}`",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user