about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-03 21:22:50 +0000
committerbors <bors@rust-lang.org>2022-04-03 21:22:50 +0000
commit6af09d2505f38e4f1df291df56d497fb2ad935ed (patch)
treeb0006d75855880faca5257f11ff60d90505b9e93 /compiler/rustc_codegen_gcc
parent2ad4eb207b369017f5140918b5e4b0d3650b46b0 (diff)
parent1ea6e936106cbf93d8b32844f2d2598a599a89b4 (diff)
downloadrust-6af09d2505f38e4f1df291df56d497fb2ad935ed.tar.gz
rust-6af09d2505f38e4f1df291df56d497fb2ad935ed.zip
Auto merge of #95624 - Dylan-DPC:rollup-r8w7ui3, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95202 (Reduce the cost of loading all built-ins targets)
 - #95553 (Don't emit non-asm contents error for naked function composed of errors)
 - #95613 (Fix rustdoc attribute display)
 - #95617 (Fix &mut invalidation in ptr::swap doctest)
 - #95618 (core: document that the align_of* functions return the alignment in bytes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_gcc')
-rw-r--r--compiler/rustc_codegen_gcc/src/lib.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs
index eac4a06226c..497a28354d8 100644
--- a/compiler/rustc_codegen_gcc/src/lib.rs
+++ b/compiler/rustc_codegen_gcc/src/lib.rs
@@ -287,8 +287,10 @@ fn handle_native(name: &str) -> &str {
 }
 
 pub fn target_cpu(sess: &Session) -> &str {
-    let name = sess.opts.cg.target_cpu.as_ref().unwrap_or(&sess.target.cpu);
-    handle_native(name)
+    match sess.opts.cg.target_cpu {
+        Some(ref name) => handle_native(name),
+        None => handle_native(sess.target.cpu.as_ref()),
+    }
 }
 
 pub fn target_features(sess: &Session) -> Vec<Symbol> {