about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-03-29 05:00:58 +0000
committerbors <bors@rust-lang.org>2019-03-29 05:00:58 +0000
commit4fec737f9aad565ef0351c38f147b78394b7a8ac (patch)
treedc86fbe608d09c12a68c285b86d247db3a2f1c16 /src/librustc_codegen_ssa
parent70a497a43794f0da5610c6da835ed3e02cd9af4d (diff)
parent8d4afbe4136933b47082dd1efa9c1132a31dfb0d (diff)
downloadrust-4fec737f9aad565ef0351c38f147b78394b7a8ac.tar.gz
rust-4fec737f9aad565ef0351c38f147b78394b7a8ac.zip
Auto merge of #58605 - nagisa:fix-the-metadata, r=michaelwoerister
Use informational target machine for metadata

Since there is nothing to optimise there...

Should fix #58323 but haven’t tested locally.

r? @michaelwoerister
Diffstat (limited to 'src/librustc_codegen_ssa')
-rw-r--r--src/librustc_codegen_ssa/back/write.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs
index 859dfb99d92..55b7855ac08 100644
--- a/src/librustc_codegen_ssa/back/write.rs
+++ b/src/librustc_codegen_ssa/back/write.rs
@@ -1075,7 +1075,13 @@ fn start_executing_work<B: ExtraBackendMethods>(
         None
     };
 
-    let ol = tcx.backend_optimization_level(LOCAL_CRATE);
+    let ol = if tcx.sess.opts.debugging_opts.no_codegen
+             || !tcx.sess.opts.output_types.should_codegen() {
+        // If we know that we won’t be doing codegen, create target machines without optimisation.
+        config::OptLevel::No
+    } else {
+        tcx.backend_optimization_level(LOCAL_CRATE)
+    };
     let cgcx = CodegenContext::<B> {
         backend: backend.clone(),
         crate_types: sess.crate_types.borrow().clone(),