Auto merge of #33732 - nikomatsakis:incr-comp-empty-cgu, r=mw

always make at least one codegen-unit

this allows us to remove the dummy `foo` fn

r? @michaelwoerister
This commit is contained in:
bors 2016-05-25 16:53:05 -07:00
commit 267cde2598
2 changed files with 11 additions and 2 deletions

View File

@ -228,6 +228,17 @@ fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}
// always ensure we have at least one CGU; otherwise, if we have a
// crate with just types (for example), we could wind up with no CGU
if codegen_units.is_empty() {
let codegen_unit_name = InternedString::new(FALLBACK_CODEGEN_UNIT);
codegen_units.entry(codegen_unit_name.clone())
.or_insert_with(|| CodegenUnit {
name: codegen_unit_name.clone(),
items: FnvHashMap(),
});
}
PreInliningPartitioning {
codegen_units: codegen_units.into_iter()
.map(|(_, codegen_unit)| codegen_unit)

View File

@ -17,5 +17,3 @@ pub type X = u32;
pub type X = i32;
pub type Y = char;
pub fn foo() { }