Use () for codegen queries.

This commit is contained in:
Camille GILLOT 2021-05-11 14:39:04 +02:00
parent 4e8d4bdf4b
commit 0bde3b1f80
15 changed files with 40 additions and 56 deletions

View file

@ -230,7 +230,7 @@ fn exported_symbols_provider_local(
// external linkage is enough for monomorphization to be linked to.
let need_visibility = tcx.sess.target.dynamic_linking && !tcx.sess.target.only_cdylib;
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
let (_, cgus) = tcx.collect_and_partition_mono_items(());
for (mono_item, &(linkage, visibility)) in cgus.iter().flat_map(|cgu| cgu.items().iter()) {
if linkage != Linkage::External {
@ -275,10 +275,8 @@ fn exported_symbols_provider_local(
fn upstream_monomorphizations_provider(
tcx: TyCtxt<'_>,
cnum: CrateNum,
(): (),
) -> DefIdMap<FxHashMap<SubstsRef<'_>, CrateNum>> {
debug_assert!(cnum == LOCAL_CRATE);
let cnums = tcx.all_crate_nums(());
let mut instances: DefIdMap<FxHashMap<_, _>> = Default::default();
@ -341,7 +339,7 @@ fn upstream_monomorphizations_for_provider(
def_id: DefId,
) -> Option<&FxHashMap<SubstsRef<'_>, CrateNum>> {
debug_assert!(!def_id.is_local());
tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id)
tcx.upstream_monomorphizations(()).get(&def_id)
}
fn upstream_drop_glue_for_provider<'tcx>(

View file

@ -482,7 +482,7 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
codegen_worker_receive,
shared_emitter_main,
future: coordinator_thread,
output_filenames: tcx.output_filenames(LOCAL_CRATE),
output_filenames: tcx.output_filenames(()),
}
}
@ -1042,7 +1042,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
// If we know that we wont be doing codegen, create target machines without optimisation.
config::OptLevel::No
} else {
tcx.backend_optimization_level(LOCAL_CRATE)
tcx.backend_optimization_level(())
};
let cgcx = CodegenContext::<B> {
backend: backend.clone(),
@ -1061,7 +1061,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
cgu_reuse_tracker: sess.cgu_reuse_tracker.clone(),
coordinator_send,
diag_emitter: shared_emitter.clone(),
output_filenames: tcx.output_filenames(LOCAL_CRATE),
output_filenames: tcx.output_filenames(()),
regular_module_config: regular_config,
metadata_module_config: metadata_config,
allocator_module_config: allocator_config,

View file

@ -485,7 +485,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
// Run the monomorphization collector and partition the collected items into
// codegen units.
let codegen_units = tcx.collect_and_partition_mono_items(LOCAL_CRATE).1;
let codegen_units = tcx.collect_and_partition_mono_items(()).1;
// Force all codegen_unit queries so they are already either red or green
// when compile_codegen_unit accesses them. We are not able to re-execute