From: Camille GILLOT Date: Sun, 6 Jun 2021 09:30:08 +0000 (+0200) Subject: Implement the query in cstore_impl. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=cbdfbdd40bb6c25cf33c922339f0b303d0576377;p=rust.git Implement the query in cstore_impl. --- diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 9a97835d9c0..5e116122179 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -4,7 +4,6 @@ use crate::rmeta::encoder; use rustc_ast as ast; -use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::stable_map::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_hir as hir; @@ -242,6 +241,7 @@ pub fn provide(providers: &mut Providers) { // therefore no actual inputs, they're just reading tables calculated in // resolve! Does this work? Unsure! That's what the issue is about *providers = Providers { + allocator_kind: |tcx, ()| CStore::from_tcx(tcx).allocator_kind(), is_dllimport_foreign_item: |tcx, id| match tcx.native_library_kind(id) { Some( NativeLibKind::Dylib { .. } | NativeLibKind::RawDylib | NativeLibKind::Unspecified, @@ -535,8 +535,4 @@ fn crates_untracked(&self) -> Vec { fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata { encoder::encode_metadata(tcx) } - - fn allocator_kind(&self) -> Option { - self.allocator_kind() - } } diff --git a/compiler/rustc_middle/src/middle/cstore.rs b/compiler/rustc_middle/src/middle/cstore.rs index a7ab43d106c..1f40b227d91 100644 --- a/compiler/rustc_middle/src/middle/cstore.rs +++ b/compiler/rustc_middle/src/middle/cstore.rs @@ -5,7 +5,6 @@ use crate::ty::TyCtxt; use rustc_ast as ast; -use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; use rustc_hir::def::DefKind; @@ -215,7 +214,6 @@ fn def_path_hash_to_def_id( // utility functions fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata; - fn allocator_kind(&self) -> Option; } pub type CrateStoreDyn = dyn CrateStore + sync::Sync; diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 558d3adffa9..0c3a01bcb73 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2834,5 +2834,4 @@ pub fn provide(providers: &mut ty::query::Providers) { // We want to check if the panic handler was defined in this crate tcx.lang_items().panic_impl().map_or(false, |did| did.is_local()) }; - providers.allocator_kind = |tcx, ()| tcx.cstore.allocator_kind(); }