Implement the query in cstore_impl.
This commit is contained in:
parent
ed9ee25108
commit
cbdfbdd40b
3 changed files with 1 additions and 8 deletions
|
@ -4,7 +4,6 @@ use crate::native_libs;
|
||||||
use crate::rmeta::encoder;
|
use crate::rmeta::encoder;
|
||||||
|
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::expand::allocator::AllocatorKind;
|
|
||||||
use rustc_data_structures::stable_map::FxHashMap;
|
use rustc_data_structures::stable_map::FxHashMap;
|
||||||
use rustc_data_structures::svh::Svh;
|
use rustc_data_structures::svh::Svh;
|
||||||
use rustc_hir as hir;
|
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
|
// therefore no actual inputs, they're just reading tables calculated in
|
||||||
// resolve! Does this work? Unsure! That's what the issue is about
|
// resolve! Does this work? Unsure! That's what the issue is about
|
||||||
*providers = Providers {
|
*providers = Providers {
|
||||||
|
allocator_kind: |tcx, ()| CStore::from_tcx(tcx).allocator_kind(),
|
||||||
is_dllimport_foreign_item: |tcx, id| match tcx.native_library_kind(id) {
|
is_dllimport_foreign_item: |tcx, id| match tcx.native_library_kind(id) {
|
||||||
Some(
|
Some(
|
||||||
NativeLibKind::Dylib { .. } | NativeLibKind::RawDylib | NativeLibKind::Unspecified,
|
NativeLibKind::Dylib { .. } | NativeLibKind::RawDylib | NativeLibKind::Unspecified,
|
||||||
|
@ -535,8 +535,4 @@ impl CrateStore for CStore {
|
||||||
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
|
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||||
encoder::encode_metadata(tcx)
|
encoder::encode_metadata(tcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allocator_kind(&self) -> Option<AllocatorKind> {
|
|
||||||
self.allocator_kind()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
use crate::ty::TyCtxt;
|
use crate::ty::TyCtxt;
|
||||||
|
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::expand::allocator::AllocatorKind;
|
|
||||||
use rustc_data_structures::svh::Svh;
|
use rustc_data_structures::svh::Svh;
|
||||||
use rustc_data_structures::sync::{self, MetadataRef};
|
use rustc_data_structures::sync::{self, MetadataRef};
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
|
@ -215,7 +214,6 @@ pub trait CrateStore {
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
|
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
|
||||||
fn allocator_kind(&self) -> Option<AllocatorKind>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
|
pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
|
||||||
|
|
|
@ -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
|
// 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())
|
tcx.lang_items().panic_impl().map_or(false, |did| did.is_local())
|
||||||
};
|
};
|
||||||
providers.allocator_kind = |tcx, ()| tcx.cstore.allocator_kind();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue