Skip to content

Commit

Permalink
rustc: Flag metadata compatible with multiple CGUs
Browse files Browse the repository at this point in the history
It looks like the `OutputType::Metadata` kind in the compiler was
misclassified in #38571 long ago by accident as incompatible with
codegen units and a single output file. This means that if you emit both
a linkable artifact and metadata it silently turns off multiple codegen
units unintentionally!

This commit corrects the situation to ensure that if `--emit metadata`
is used it doesn't implicitly disable multiple codegen units. This will
ensure we don't accidentally regress compiler performance when striving
to implement pipelined compilation!
  • Loading branch information
alexcrichton committed Apr 25, 2019
1 parent 112f7e9 commit 955f283
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc/session/config.rs
Expand Up @@ -153,13 +153,12 @@ impl_stable_hash_via_hash!(OutputType);
impl OutputType {
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
match *self {
OutputType::Exe | OutputType::DepInfo => true,
OutputType::Exe | OutputType::DepInfo | OutputType::Metadata => true,
OutputType::Bitcode
| OutputType::Assembly
| OutputType::LlvmAssembly
| OutputType::Mir
| OutputType::Object
| OutputType::Metadata => false,
| OutputType::Object => false,
}
}

Expand Down

0 comments on commit 955f283

Please sign in to comment.