Update upstream_monomorphizations and upstream_monomorphizations_for

This commit is contained in:
John Kåre Alsaker 2018-11-30 21:05:48 +01:00
parent 99f6221bb6
commit 95dfd82666
3 changed files with 13 additions and 10 deletions

View File

@ -60,6 +60,13 @@ macro_rules! arena_types {
>,
[few] crate_inherent_impls: rustc::ty::CrateInherentImpls,
[decode] borrowck: rustc::middle::borrowck::BorrowCheckResult,
[few] upstream_monomorphizations:
rustc::util::nodemap::DefIdMap<
rustc_data_structures::fx::FxHashMap<
rustc::ty::subst::SubstsRef<'tcx>,
rustc::hir::def_id::CrateNum
>
>,
], $tcx);
)
}

View File

@ -681,11 +681,11 @@ rustc_queries! {
Codegen {
query upstream_monomorphizations(
k: CrateNum
) -> Lrc<DefIdMap<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>> {
) -> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> {
desc { "collecting available upstream monomorphizations `{:?}`", k }
}
query upstream_monomorphizations_for(_: DefId)
-> Option<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>> {}
-> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>> {}
}
Other {

View File

@ -282,7 +282,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fn upstream_monomorphizations_provider<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
cnum: CrateNum)
-> Lrc<DefIdMap<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>>
-> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>>
{
debug_assert!(cnum == LOCAL_CRATE);
@ -326,20 +326,16 @@ fn upstream_monomorphizations_provider<'a, 'tcx>(
}
}
Lrc::new(instances.into_iter()
.map(|(key, value)| (key, Lrc::new(value)))
.collect())
tcx.arena.alloc(instances)
}
fn upstream_monomorphizations_for_provider<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId)
-> Option<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>
-> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>>
{
debug_assert!(!def_id.is_local());
tcx.upstream_monomorphizations(LOCAL_CRATE)
.get(&def_id)
.cloned()
tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id)
}
fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> bool {