Skip to content

Commit aaa6c40

Browse files
authored
Rollup merge of #93489 - Amanieu:panic_no_unwind, r=nagisa
Mark the panic_no_unwind lang item as nounwind This has 2 effects: - It helps LLVM when inlining since it doesn't need to generate landing pads for `panic_no_unwind`. - It makes it sound for a panic handler to unwind even if `PanicInfo::can_unwind` returns true. This will simply cause another panic once the unwind tries to go past the `panic_no_unwind` lang item. Eventually this will cause a stack overflow, which is safe.
2 parents 4c12881 + 1d0c6e3 commit aaa6c40

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/panic/panic_info.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ impl<'a> PanicInfo<'a> {
136136
/// This is true for most kinds of panics with the exception of panics
137137
/// caused by trying to unwind out of a `Drop` implementation or a function
138138
/// whose ABI does not support unwinding.
139+
///
140+
/// It is safe for a panic handler to unwind even when this function returns
141+
/// true, however this will simply cause the panic handler to be called
142+
/// again.
139143
#[must_use]
140144
#[unstable(feature = "panic_can_unwind", issue = "92988")]
141145
pub fn can_unwind(&self) -> bool {

0 commit comments

Comments
 (0)