about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-15 09:27:21 +0000
committerbors <bors@rust-lang.org>2021-01-15 09:27:21 +0000
commit4e208f6a3afb42528878b0f3464e337c4bf3bbc8 (patch)
tree21529ff86f6f364980511a8cb4cb7a0001ae29c0 /compiler/rustc_codegen_llvm/src
parentdcf622eb70aebe16d40c5f88fa2a41fa7019541c (diff)
parent7286be15fa3f18ea4bd5b6ce481426f7d78e4a57 (diff)
downloadrust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.tar.gz
rust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.zip
Auto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #80254 (Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`)
 - #80834 (Remove unreachable panics from VecDeque::{front/back}[_mut])
 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #81008 (Don't ICE when computing a layout of a generator tainted by errors)
 - #81023 (Remove doctree::Variant)

Failed merges:

 - #81033 (Remove useless `clean::Variant` struct)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs3
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs5
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 68f319ade1e..e225730dce0 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -1002,8 +1002,7 @@ pub unsafe fn with_llvm_pmb(
     // reasonable defaults and prepare it to actually populate the pass
     // manager.
     let builder = llvm::LLVMPassManagerBuilderCreate();
-    let opt_size =
-        config.opt_size.map(|x| to_llvm_opt_settings(x).1).unwrap_or(llvm::CodeGenOptSizeNone);
+    let opt_size = config.opt_size.map_or(llvm::CodeGenOptSizeNone, |x| to_llvm_opt_settings(x).1);
     let inline_threshold = config.inline_threshold;
     let pgo_gen_path = get_pgo_gen_path(config);
     let pgo_use_path = get_pgo_use_path(config);
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 36a21b38c03..b9ae7963250 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -1832,8 +1832,9 @@ impl<'tcx> VariantInfo<'_, 'tcx> {
     fn source_info(&self, cx: &CodegenCx<'ll, 'tcx>) -> Option<SourceInfo<'ll>> {
         match self {
             VariantInfo::Generator { def_id, variant_index, .. } => {
-                let span =
-                    cx.tcx.generator_layout(*def_id).variant_source_info[*variant_index].span;
+                let span = cx.tcx.generator_layout(*def_id).unwrap().variant_source_info
+                    [*variant_index]
+                    .span;
                 if !span.is_dummy() {
                     let loc = cx.lookup_debug_loc(span.lo());
                     return Some(SourceInfo {