use rustc_span::symbol::{sym, Symbol};
-#[derive(Clone, Copy)]
+#[derive(Clone, Debug, Copy, HashStable_Generic)]
pub enum AllocatorKind {
Global,
Default,
});
if any_dynamic_crate {
false
- } else if let Some(kind) = tcx.allocator_kind() {
+ } else if let Some(kind) = tcx.allocator_kind(()) {
codegen_inner(module, unwind_context, kind);
true
} else {
symbols.push((exported_symbol, SymbolExportLevel::C));
}
- if tcx.allocator_kind().is_some() {
+ if tcx.allocator_kind(()).is_some() {
for method in ALLOCATOR_METHODS {
let symbol_name = format!("__rust_{}", method.name);
let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name));
});
let allocator_module = if any_dynamic_crate {
None
- } else if let Some(kind) = tcx.allocator_kind() {
+ } else if let Some(kind) = tcx.allocator_kind(()) {
let llmod_id =
cgu_name_builder.build_cgu_name(LOCAL_CRATE, &["crate"], Some("allocator")).to_string();
let mut modules = backend.new_metadata(tcx, &llmod_id);
eval_always
desc { "check whether crate {} is a private dependency", c }
}
+ query allocator_kind(_: ()) -> Option<AllocatorKind> {
+ eval_always
+ desc { "allocator kind for the current crate" }
+ }
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut, UintTy, Visibility,
};
use rustc_ast as ast;
-use rustc_ast::expand::allocator::AllocatorKind;
use rustc_attr as attr;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::profiling::SelfProfilerRef;
self.all_crate_nums(())
}
- pub fn allocator_kind(self) -> Option<AllocatorKind> {
- self.cstore.allocator_kind()
- }
-
pub fn features(self) -> &'tcx rustc_feature::Features {
self.features_query(())
}
// 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();
}
use crate::ty::subst::{GenericArg, SubstsRef};
use crate::ty::util::AlwaysRequiresDrop;
use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
+use rustc_ast::expand::allocator::AllocatorKind;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::steal::Steal;
use rustc_data_structures::svh::Svh;