Make iteration order of collect_return_position_impl_trait_in_trait_tys query stable
This commit is contained in:
parent
5449638d7d
commit
5c8eee4275
6 changed files with 14 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
||||||
use super::potentially_plural_count;
|
use super::potentially_plural_count;
|
||||||
use crate::errors::LifetimesOrBoundsMismatchOnTrait;
|
use crate::errors::LifetimesOrBoundsMismatchOnTrait;
|
||||||
use hir::def_id::{DefId, LocalDefId};
|
use hir::def_id::{DefId, DefIdMap, LocalDefId};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
||||||
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, ErrorGuaranteed};
|
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, ErrorGuaranteed};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
@ -478,7 +478,7 @@ fn compare_asyncness<'tcx>(
|
||||||
pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
impl_m_def_id: LocalDefId,
|
impl_m_def_id: LocalDefId,
|
||||||
) -> Result<&'tcx FxHashMap<DefId, ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed> {
|
) -> Result<&'tcx DefIdMap<ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed> {
|
||||||
let impl_m = tcx.opt_associated_item(impl_m_def_id.to_def_id()).unwrap();
|
let impl_m = tcx.opt_associated_item(impl_m_def_id.to_def_id()).unwrap();
|
||||||
let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap();
|
let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap();
|
||||||
let impl_trait_ref =
|
let impl_trait_ref =
|
||||||
|
@ -706,7 +706,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
||||||
);
|
);
|
||||||
ocx.resolve_regions_and_report_errors(impl_m_def_id, &outlives_env)?;
|
ocx.resolve_regions_and_report_errors(impl_m_def_id, &outlives_env)?;
|
||||||
|
|
||||||
let mut remapped_types = FxHashMap::default();
|
let mut remapped_types = DefIdMap::default();
|
||||||
for (def_id, (ty, args)) in collected_types {
|
for (def_id, (ty, args)) in collected_types {
|
||||||
match infcx.fully_resolve((ty, args)) {
|
match infcx.fully_resolve((ty, args)) {
|
||||||
Ok((ty, args)) => {
|
Ok((ty, args)) => {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use rustc_attr as attr;
|
||||||
use rustc_data_structures::svh::Svh;
|
use rustc_data_structures::svh::Svh;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap};
|
use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap};
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, DefPathHash, StableCrateId};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIndex, DefPathHash, StableCrateId};
|
||||||
use rustc_hir::definitions::DefKey;
|
use rustc_hir::definitions::DefKey;
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_index::bit_set::BitSet;
|
use rustc_index::bit_set::BitSet;
|
||||||
|
@ -459,7 +459,7 @@ define_tables! {
|
||||||
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
|
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
|
||||||
proc_macro: Table<DefIndex, MacroKind>,
|
proc_macro: Table<DefIndex, MacroKind>,
|
||||||
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
|
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
|
||||||
trait_impl_trait_tys: Table<DefIndex, LazyValue<FxHashMap<DefId, ty::EarlyBinder<Ty<'static>>>>>,
|
trait_impl_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<Ty<'static>>>>>,
|
||||||
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
|
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
|
||||||
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,
|
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,
|
||||||
assumed_wf_types_for_rpitit: Table<DefIndex, LazyArray<(Ty<'static>, Span)>>,
|
assumed_wf_types_for_rpitit: Table<DefIndex, LazyArray<(Ty<'static>, Span)>>,
|
||||||
|
|
|
@ -103,7 +103,7 @@ macro_rules! arena_types {
|
||||||
[] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>,
|
[] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>,
|
||||||
|
|
||||||
[decode] trait_impl_trait_tys:
|
[decode] trait_impl_trait_tys:
|
||||||
rustc_data_structures::fx::FxHashMap<
|
rustc_data_structures::unord::UnordMap<
|
||||||
rustc_hir::def_id::DefId,
|
rustc_hir::def_id::DefId,
|
||||||
rustc_middle::ty::EarlyBinder<rustc_middle::ty::Ty<'tcx>>
|
rustc_middle::ty::EarlyBinder<rustc_middle::ty::Ty<'tcx>>
|
||||||
>,
|
>,
|
||||||
|
|
|
@ -57,7 +57,7 @@ use rustc_ast as ast;
|
||||||
use rustc_ast::expand::{allocator::AllocatorKind, StrippedCfgItem};
|
use rustc_ast::expand::{allocator::AllocatorKind, StrippedCfgItem};
|
||||||
use rustc_attr as attr;
|
use rustc_attr as attr;
|
||||||
use rustc_data_structures::fingerprint::Fingerprint;
|
use rustc_data_structures::fingerprint::Fingerprint;
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||||
use rustc_data_structures::steal::Steal;
|
use rustc_data_structures::steal::Steal;
|
||||||
use rustc_data_structures::svh::Svh;
|
use rustc_data_structures::svh::Svh;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
|
@ -264,7 +264,7 @@ rustc_queries! {
|
||||||
}
|
}
|
||||||
|
|
||||||
query collect_return_position_impl_trait_in_trait_tys(key: DefId)
|
query collect_return_position_impl_trait_in_trait_tys(key: DefId)
|
||||||
-> Result<&'tcx FxHashMap<DefId, ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed>
|
-> Result<&'tcx DefIdMap<ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed>
|
||||||
{
|
{
|
||||||
desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
|
desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { key.is_local() }
|
||||||
|
|
|
@ -2,7 +2,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||||
use rustc_data_structures::memmap::Mmap;
|
use rustc_data_structures::memmap::Mmap;
|
||||||
use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, RwLock};
|
use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, RwLock};
|
||||||
use rustc_data_structures::unhash::UnhashMap;
|
use rustc_data_structures::unhash::UnhashMap;
|
||||||
use rustc_data_structures::unord::UnordSet;
|
use rustc_data_structures::unord::{UnordMap, UnordSet};
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, StableCrateId, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, StableCrateId, LOCAL_CRATE};
|
||||||
use rustc_hir::definitions::DefPathHash;
|
use rustc_hir::definitions::DefPathHash;
|
||||||
use rustc_index::{Idx, IndexVec};
|
use rustc_index::{Idx, IndexVec};
|
||||||
|
@ -764,7 +764,7 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx UnordSet<LocalDefId>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>>
|
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>>
|
||||||
for &'tcx FxHashMap<DefId, ty::EarlyBinder<Ty<'tcx>>>
|
for &'tcx UnordMap<DefId, ty::EarlyBinder<Ty<'tcx>>>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Self {
|
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Self {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::unord::UnordMap;
|
||||||
use rustc_hir::def_id::DefIndex;
|
use rustc_hir::def_id::DefIndex;
|
||||||
use rustc_index::{Idx, IndexVec};
|
use rustc_index::{Idx, IndexVec};
|
||||||
|
use std::hash::Hash;
|
||||||
|
|
||||||
use crate::ty;
|
use crate::ty;
|
||||||
|
|
||||||
|
@ -24,8 +25,8 @@ impl<I: Idx + 'static, T: ParameterizedOverTcx> ParameterizedOverTcx for IndexVe
|
||||||
type Value<'tcx> = IndexVec<I, T::Value<'tcx>>;
|
type Value<'tcx> = IndexVec<I, T::Value<'tcx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I: 'static, T: ParameterizedOverTcx> ParameterizedOverTcx for FxHashMap<I, T> {
|
impl<I: Hash + Eq + 'static, T: ParameterizedOverTcx> ParameterizedOverTcx for UnordMap<I, T> {
|
||||||
type Value<'tcx> = FxHashMap<I, T::Value<'tcx>>;
|
type Value<'tcx> = UnordMap<I, T::Value<'tcx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ParameterizedOverTcx> ParameterizedOverTcx for ty::Binder<'static, T> {
|
impl<T: ParameterizedOverTcx> ParameterizedOverTcx for ty::Binder<'static, T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue