From 42972f52de2aedbc8cc96a3f4b28c4330822aecd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 31 Mar 2024 11:54:16 +0200 Subject: [PATCH] catch_panic: warn about panicking payload drop --- library/std/src/panic.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 3d576af681e03..e63b46ab70548 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -126,6 +126,9 @@ where /// Also note that unwinding into Rust code with a foreign exception (e.g. /// an exception thrown from C++ code) is undefined behavior. /// +/// Finally, be **careful in how you drop the result of this function**. +/// If it is `Err`, it contains the panic payload, and dropping that may in turn panic! +/// /// # Examples /// /// ```