Skip to content

Commit 3396a38

Browse files
committedMay 17, 2021
Auto merge of #85178 - cjgillot:local-crate, r=oli-obk
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
·
1.88.01.54.0
2 parents a55748f + 1ebf6d1 commit 3396a38

File tree

70 files changed

+280
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+280
-403
lines changed
 

‎compiler/rustc_codegen_cranelift/src/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(crate) fn codegen(
1313
module: &mut impl Module,
1414
unwind_context: &mut UnwindContext,
1515
) -> bool {
16-
let any_dynamic_crate = tcx.dependency_formats(LOCAL_CRATE).iter().any(|(_, list)| {
16+
let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
1717
use rustc_middle::middle::dependency_format::Linkage;
1818
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
1919
});

‎compiler/rustc_codegen_cranelift/src/driver/aot.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn emit_module(
4242

4343
unwind_context.emit(&mut product);
4444

45-
let tmp_file = tcx.output_filenames(LOCAL_CRATE).temp_path(OutputType::Object, Some(&name));
45+
let tmp_file = tcx.output_filenames(()).temp_path(OutputType::Object, Some(&name));
4646
let obj = product.object.write().unwrap();
4747
if let Err(err) = std::fs::write(&tmp_file, obj) {
4848
tcx.sess.fatal(&format!("error writing object file: {}", err));
@@ -74,7 +74,7 @@ fn reuse_workproduct_for_cgu(
7474
let work_product = cgu.work_product(tcx);
7575
if let Some(saved_file) = &work_product.saved_file {
7676
let obj_out = tcx
77-
.output_filenames(LOCAL_CRATE)
77+
.output_filenames(())
7878
.temp_path(OutputType::Object, Some(&cgu.name().as_str()));
7979
object = Some(obj_out.clone());
8080
let source_file = rustc_incremental::in_incr_comp_dir(&incr_comp_session_dir, &saved_file);
@@ -190,7 +190,7 @@ pub(crate) fn run_aot(
190190
let mut work_products = FxHashMap::default();
191191

192192
let cgus = if tcx.sess.opts.output_types.should_codegen() {
193-
tcx.collect_and_partition_mono_items(LOCAL_CRATE).1
193+
tcx.collect_and_partition_mono_items(()).1
194194
} else {
195195
// If only `--emit metadata` is used, we shouldn't perform any codegen.
196196
// Also `tcx.collect_and_partition_mono_items` may panic in that case.
@@ -276,7 +276,7 @@ pub(crate) fn run_aot(
276276
.to_string();
277277

278278
let tmp_file = tcx
279-
.output_filenames(LOCAL_CRATE)
279+
.output_filenames(())
280280
.temp_path(OutputType::Metadata, Some(&metadata_cgu_name));
281281

282282
let obj = crate::backend::with_object(tcx.sess, &metadata_cgu_name, |object| {
@@ -353,7 +353,7 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) {
353353
.join("\n");
354354

355355
let output_object_file =
356-
tcx.output_filenames(LOCAL_CRATE).temp_path(OutputType::Object, Some(cgu_name));
356+
tcx.output_filenames(()).temp_path(OutputType::Object, Some(cgu_name));
357357

358358
// Assemble `global_asm`
359359
let global_asm_object_file = add_file_stem_postfix(output_object_file.clone(), ".asm");

0 commit comments

Comments
 (0)
Please sign in to comment.