about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2022-01-29 11:54:16 +0000
committerAmanieu d'Antras <amanieu@gmail.com>2022-01-29 11:54:16 +0000
commitc4f2d21f1a9e41c025cc8cfca5f5f06053aba70e (patch)
treee9fc93c8f93439b2ed73c99be0080738ca4cfd0e
parent24ae9960c5116a6d1e827c58327e6d231e4fe174 (diff)
downloadrust-c4f2d21f1a9e41c025cc8cfca5f5f06053aba70e.tar.gz
rust-c4f2d21f1a9e41c025cc8cfca5f5f06053aba70e.zip
Mark the panic_no_unwind lang item as nounwind
-rw-r--r--compiler/rustc_typeck/src/collect.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs
index cf519a9ab32..7c8a47d5d65 100644
--- a/compiler/rustc_typeck/src/collect.rs
+++ b/compiler/rustc_typeck/src/collect.rs
@@ -2778,6 +2778,13 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
         }
     }
 
+    // The panic_no_unwind function called by TerminatorKind::Abort will never
+    // unwind. If the panic handler that it invokes unwind then it will simply
+    // call the panic handler again.
+    if Some(id) == tcx.lang_items().panic_no_unwind() {
+        codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND;
+    }
+
     let supported_target_features = tcx.supported_target_features(LOCAL_CRATE);
 
     let mut inline_span = None;