mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Use () in dependency_formats.
This commit is contained in:
parent
ac923d94f8
commit
85a14d70bb
@ -13,7 +13,7 @@ pub(crate) fn codegen(
|
||||
module: &mut impl Module,
|
||||
unwind_context: &mut UnwindContext,
|
||||
) -> bool {
|
||||
let any_dynamic_crate = tcx.dependency_formats(LOCAL_CRATE).iter().any(|(_, list)| {
|
||||
let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
|
||||
use rustc_middle::middle::dependency_format::Linkage;
|
||||
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
|
||||
});
|
||||
|
@ -179,7 +179,7 @@ fn load_imported_symbols_for_jit(tcx: TyCtxt<'_>) -> Vec<(String, *const u8)> {
|
||||
let mut dylib_paths = Vec::new();
|
||||
|
||||
let crate_info = CrateInfo::new(tcx);
|
||||
let formats = tcx.dependency_formats(LOCAL_CRATE);
|
||||
let formats = tcx.dependency_formats(());
|
||||
let data = &formats
|
||||
.iter()
|
||||
.find(|(crate_type, _data)| *crate_type == rustc_session::config::CrateType::Executable)
|
||||
|
@ -1303,7 +1303,7 @@ fn exported_symbols(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> {
|
||||
}
|
||||
}
|
||||
|
||||
let formats = tcx.dependency_formats(LOCAL_CRATE);
|
||||
let formats = tcx.dependency_formats(());
|
||||
let deps = formats.iter().find_map(|(t, list)| (*t == crate_type).then_some(list)).unwrap();
|
||||
|
||||
for (index, dep_format) in deps.iter().enumerate() {
|
||||
|
@ -511,7 +511,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
// linkage, then it's already got an allocator shim and we'll be using that
|
||||
// one instead. If nothing exists then it's our job to generate the
|
||||
// allocator!
|
||||
let any_dynamic_crate = tcx.dependency_formats(LOCAL_CRATE).iter().any(|(_, list)| {
|
||||
let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
|
||||
use rustc_middle::middle::dependency_format::Linkage;
|
||||
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
|
||||
});
|
||||
@ -768,7 +768,7 @@ impl CrateInfo {
|
||||
used_crate_source: Default::default(),
|
||||
lang_item_to_crate: Default::default(),
|
||||
missing_lang_items: Default::default(),
|
||||
dependency_formats: tcx.dependency_formats(LOCAL_CRATE),
|
||||
dependency_formats: tcx.dependency_formats(()),
|
||||
};
|
||||
let lang_items = tcx.lang_items();
|
||||
|
||||
|
@ -370,10 +370,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
visible_parent_map
|
||||
},
|
||||
|
||||
dependency_formats: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
Lrc::new(crate::dependency_format::calculate(tcx))
|
||||
},
|
||||
dependency_formats: |tcx, ()| Lrc::new(crate::dependency_format::calculate(tcx)),
|
||||
has_global_allocator: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
CStore::from_tcx(tcx).has_global_allocator()
|
||||
|
@ -1773,7 +1773,7 @@ impl EncodeContext<'a, 'tcx> {
|
||||
|
||||
fn encode_dylib_dependency_formats(&mut self) -> Lazy<[Option<LinkagePreference>]> {
|
||||
empty_proc_macro!(self);
|
||||
let formats = self.tcx.dependency_formats(LOCAL_CRATE);
|
||||
let formats = self.tcx.dependency_formats(());
|
||||
for (ty, arr) in formats.iter() {
|
||||
if *ty != CrateType::Dylib {
|
||||
continue;
|
||||
|
@ -1053,9 +1053,7 @@ rustc_queries! {
|
||||
desc { "dylib dependency formats of crate" }
|
||||
}
|
||||
|
||||
query dependency_formats(_: CrateNum)
|
||||
-> Lrc<crate::middle::dependency_format::Dependencies>
|
||||
{
|
||||
query dependency_formats(_: ()) -> Lrc<crate::middle::dependency_format::Dependencies> {
|
||||
desc { "get the linkage format of all dependencies" }
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,16 @@ pub trait Key {
|
||||
fn default_span(&self, tcx: TyCtxt<'_>) -> Span;
|
||||
}
|
||||
|
||||
impl Key for () {
|
||||
fn query_crate(&self) -> CrateNum {
|
||||
LOCAL_CRATE
|
||||
}
|
||||
|
||||
fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
DUMMY_SP
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::InstanceDef<'tcx> {
|
||||
fn query_crate(&self) -> CrateNum {
|
||||
LOCAL_CRATE
|
||||
|
Loading…
Reference in New Issue
Block a user