]> git.lizzy.rs Git - rust.git/commitdiff
Implement the query in cstore_impl.
authorCamille GILLOT <gillot.camille@gmail.com>
Sun, 6 Jun 2021 09:30:08 +0000 (11:30 +0200)
committerCamille GILLOT <gillot.camille@gmail.com>
Sun, 20 Jun 2021 09:58:46 +0000 (11:58 +0200)
compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
compiler/rustc_middle/src/middle/cstore.rs
compiler/rustc_middle/src/ty/context.rs

index 9a97835d9c000e403be89c998b243b3feafb0104..5e1161221798c0200f61ad846be74d0c71f40425 100644 (file)
@@ -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<CrateNum> {
     fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
         encoder::encode_metadata(tcx)
     }
-
-    fn allocator_kind(&self) -> Option<AllocatorKind> {
-        self.allocator_kind()
-    }
 }
index a7ab43d106c4a45d9a567435569b714876985344..1f40b227d9153fc6ac0b7b4d951f247142f9cdc7 100644 (file)
@@ -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<AllocatorKind>;
 }
 
 pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
index 558d3adffa9945b392f49f4cff93649466ceccc5..0c3a01bcb73f473bc3a20c7f7e4495db42734146 100644 (file)
@@ -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();
 }