]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Flag metadata compatible with multiple CGUs
authorAlex Crichton <alex@alexcrichton.com>
Thu, 25 Apr 2019 16:06:38 +0000 (09:06 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 25 Apr 2019 16:06:38 +0000 (09:06 -0700)
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!

src/librustc/session/config.rs

index cb307800fcdc26b8f0a54d4941c2942679d436e4..92a3469526227596248bbff0a863cadbeb46f985 100644 (file)
@@ -153,13 +153,12 @@ pub enum 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,
         }
     }