Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
always make at least one codegen-unit
this allows us to remove the dummy `foo` fn
  • Loading branch information
nikomatsakis committed May 19, 2016
1 parent 9a14045 commit 02af34d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/librustc_trans/partitioning.rs
Expand Up @@ -228,6 +228,17 @@ fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}

// always ensure we have at least one CGO; 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)
Expand Down
2 changes: 0 additions & 2 deletions src/test/incremental/type_alias_cross_crate/auxiliary/a.rs
Expand Up @@ -17,5 +17,3 @@ pub type X = u32;
pub type X = i32;

pub type Y = char;

pub fn foo() { }

0 comments on commit 02af34d

Please sign in to comment.