about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-20 07:15:40 +0000
committerbors <bors@rust-lang.org>2021-01-20 07:15:40 +0000
commita4cbb44ae2c80545db957763b502dc7f6ea22085 (patch)
tree3281c73ef832c28b327c16fb23c8c6e2e0d70435 /compiler/rustc_codegen_ssa/src/back
parente05409a02c6e73a3dea6da98798468db2910ca59 (diff)
parentf9275e1092232fcb8ec117fc4acca990f57cba15 (diff)
downloadrust-a4cbb44ae2c80545db957763b502dc7f6ea22085.tar.gz
rust-a4cbb44ae2c80545db957763b502dc7f6ea22085.zip
Auto merge of #81118 - ojeda:metadata-obj, r=nagisa
Skip linking if it is not required

This allows to use `--emit=metadata,obj` and other metadata + non-link combinations.

Fixes #81117.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index ff77db9eab8..e51904f308d 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -74,7 +74,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
             }
         });
 
-        if outputs.outputs.should_codegen() {
+        if outputs.outputs.should_link() {
             let tmpdir = TempFileBuilder::new()
                 .prefix("rustc")
                 .tempdir()
@@ -123,9 +123,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
                 }
             };
 
-            if sess.opts.output_types.should_codegen()
-                && !preserve_objects_for_their_debuginfo(sess)
-            {
+            if sess.opts.output_types.should_link() && !preserve_objects_for_their_debuginfo(sess) {
                 for module in &codegen_results.modules {
                     remove_temps_from_module(module);
                 }