Rollup merge of #60270 - alexcrichton:metadata-multi-cgu, r=oli-obk

rustc: Flag metadata compatible with multiple CGUs

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!
This commit is contained in:
Mazdak Farrokhzad 2019-04-28 14:17:10 +02:00 committed by GitHub
commit 4711051b83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,13 +155,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,
}
}