Skip to content

Commit a70c5cb

Browse files
committed
rustc: Don't create empty codegen units
This'll end up just creating a bunch of object files that otherwise wouldn't exist, so skip that extra work if possible.
1 parent 417ffc9 commit a70c5cb

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

src/librustc_trans/base.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1178,9 +1178,6 @@ fn collect_and_partition_translation_items<'a, 'tcx>(
11781178
.collect::<Vec<_>>()
11791179
});
11801180

1181-
assert!(tcx.sess.opts.codegen_units == codegen_units.len() ||
1182-
tcx.sess.opts.debugging_opts.incremental.is_some());
1183-
11841181
let translation_items: DefIdSet = items.iter().filter_map(|trans_item| {
11851182
match *trans_item {
11861183
TransItem::Fn(ref instance) => Some(instance.def_id()),

src/librustc_trans/partitioning.rs

-9
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,6 @@ fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning<
407407
for (index, cgu) in codegen_units.iter_mut().enumerate() {
408408
cgu.set_name(numbered_codegen_unit_name(crate_name, index));
409409
}
410-
411-
// If the initial partitioning contained less than target_cgu_count to begin
412-
// with, we won't have enough codegen units here, so add a empty units until
413-
// we reach the target count
414-
while codegen_units.len() < target_cgu_count {
415-
let index = codegen_units.len();
416-
let name = numbered_codegen_unit_name(crate_name, index);
417-
codegen_units.push(CodegenUnit::new(name));
418-
}
419410
}
420411

421412
fn place_inlined_translation_items<'tcx>(initial_partitioning: PreInliningPartitioning<'tcx>,

0 commit comments

Comments
 (0)