Skip to content

Commit 8878a67

Browse files
committed
Special case allocator module submission to avoid special casing it elsewhere
A lot of places had special handling just in case they would get an allocator module even though most of these places could never get one or would have a trivial implementation for the allocator module. Moving all handling of the allocator module to a single place simplifies things a fair bit.
1 parent 3293a0b commit 8878a67

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/driver/aot.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ use cranelift_object::{ObjectBuilder, ObjectModule};
1212
use rustc_codegen_ssa::assert_module_sources::CguReuse;
1313
use rustc_codegen_ssa::back::link::ensure_removed;
1414
use rustc_codegen_ssa::base::determine_cgu_reuse;
15-
use rustc_codegen_ssa::{
16-
CodegenResults, CompiledModule, CrateInfo, ModuleKind, errors as ssa_errors,
17-
};
15+
use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, errors as ssa_errors};
1816
use rustc_data_structures::profiling::SelfProfilerRef;
1917
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2018
use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
@@ -363,7 +361,6 @@ fn emit_cgu(
363361
invocation_temp,
364362
prof,
365363
product.object,
366-
ModuleKind::Regular,
367364
name.clone(),
368365
producer,
369366
)?;
@@ -372,7 +369,6 @@ fn emit_cgu(
372369
module_regular,
373370
module_global_asm: global_asm_object_file.map(|global_asm_object_file| CompiledModule {
374371
name: format!("{name}.asm"),
375-
kind: ModuleKind::Regular,
376372
object: Some(global_asm_object_file),
377373
dwarf_object: None,
378374
bytecode: None,
@@ -389,7 +385,6 @@ fn emit_module(
389385
invocation_temp: Option<&str>,
390386
prof: &SelfProfilerRef,
391387
mut object: cranelift_object::object::write::Object<'_>,
392-
kind: ModuleKind,
393388
name: String,
394389
producer_str: &str,
395390
) -> Result<CompiledModule, String> {
@@ -430,7 +425,6 @@ fn emit_module(
430425

431426
Ok(CompiledModule {
432427
name,
433-
kind,
434428
object: Some(tmp_file),
435429
dwarf_object: None,
436430
bytecode: None,
@@ -485,7 +479,6 @@ fn reuse_workproduct_for_cgu(
485479
Ok(ModuleCodegenResult {
486480
module_regular: CompiledModule {
487481
name: cgu.name().to_string(),
488-
kind: ModuleKind::Regular,
489482
object: Some(obj_out_regular),
490483
dwarf_object: None,
491484
bytecode: None,
@@ -495,7 +488,6 @@ fn reuse_workproduct_for_cgu(
495488
},
496489
module_global_asm: source_file_global_asm.map(|source_file| CompiledModule {
497490
name: cgu.name().to_string(),
498-
kind: ModuleKind::Regular,
499491
object: Some(obj_out_global_asm),
500492
dwarf_object: None,
501493
bytecode: None,
@@ -651,7 +643,6 @@ fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option<CompiledModule> {
651643
tcx.sess.invocation_temp.as_deref(),
652644
&tcx.sess.prof,
653645
product.object,
654-
ModuleKind::Allocator,
655646
"allocator_shim".to_owned(),
656647
&crate::debuginfo::producer(tcx.sess),
657648
) {

0 commit comments

Comments
 (0)