about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-09 02:42:30 +0000
committerbors <bors@rust-lang.org>2017-10-09 02:42:30 +0000
commitdbed066d49cace392a33fc4898e9b8e83c035dc2 (patch)
treed9f776932c10a223efe31d9236d9b2af7e052a74
parent97554e4b282244ceba600ea057719ccc2bc574b7 (diff)
parenta70c5cb68f84e576b16fbca86453240290e7cc22 (diff)
downloadrust-dbed066d49cace392a33fc4898e9b8e83c035dc2.tar.gz
rust-dbed066d49cace392a33fc4898e9b8e83c035dc2.zip
Auto merge of #45035 - alexcrichton:no-empty, r=michaelwoerister
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.
-rw-r--r--src/librustc_trans/base.rs3
-rw-r--r--src/librustc_trans/partitioning.rs9
2 files changed, 0 insertions, 12 deletions
diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs
index 5764b0b34d1..17e00ac1346 100644
--- a/src/librustc_trans/base.rs
+++ b/src/librustc_trans/base.rs
@@ -1231,9 +1231,6 @@ fn collect_and_partition_translation_items<'a, 'tcx>(
             .collect::<Vec<_>>()
     });
 
-    assert!(tcx.sess.opts.codegen_units == codegen_units.len() ||
-            tcx.sess.opts.debugging_opts.incremental.is_some());
-
     let translation_items: DefIdSet = items.iter().filter_map(|trans_item| {
         match *trans_item {
             TransItem::Fn(ref instance) => Some(instance.def_id()),
diff --git a/src/librustc_trans/partitioning.rs b/src/librustc_trans/partitioning.rs
index 82ec1aaa413..4656d212f9b 100644
--- a/src/librustc_trans/partitioning.rs
+++ b/src/librustc_trans/partitioning.rs
@@ -390,15 +390,6 @@ fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning<
     for (index, cgu) in codegen_units.iter_mut().enumerate() {
         cgu.set_name(numbered_codegen_unit_name(crate_name, index));
     }
-
-    // If the initial partitioning contained less than target_cgu_count to begin
-    // with, we won't have enough codegen units here, so add a empty units until
-    // we reach the target count
-    while codegen_units.len() < target_cgu_count {
-        let index = codegen_units.len();
-        let name = numbered_codegen_unit_name(crate_name, index);
-        codegen_units.push(CodegenUnit::new(name));
-    }
 }
 
 fn place_inlined_translation_items<'tcx>(initial_partitioning: PreInliningPartitioning<'tcx>,