about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2021-01-17 15:06:47 +0100
committerMiguel Ojeda <ojeda@kernel.org>2021-01-17 15:44:42 +0100
commitf9275e1092232fcb8ec117fc4acca990f57cba15 (patch)
treecd4c20d7812548bfb8fadc8a292131696f8a16aa /compiler/rustc_codegen_ssa/src
parentfc9944fe84a683f0450c0921a935456e51b1c3ae (diff)
downloadrust-f9275e1092232fcb8ec117fc4acca990f57cba15.tar.gz
rust-f9275e1092232fcb8ec117fc4acca990f57cba15.zip
Skip linking if it is not required
This allows to use `--emit=metadata,obj` and other metadata
+ non-link combinations.

Fixes #81117.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-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 728795cf50b..50a561644da 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);
                 }