Auto merge of #123266 - RalfJung:catch-panic, r=workingjubilee

catch_panic: warn about panicking payload drop

Warns about the footgun in https://github.com/rust-lang/rust/issues/86027.

Will be unnecessary if panics escaping from drop leads to abort (https://github.com/rust-lang/rfcs/pull/3288). But until that is enforced everywhere, let's warn users about this.
This commit is contained in:
bors 2024-03-31 18:34:26 +00:00
commit 204805a092

View File

@ -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
///
/// ```