Skip to content

Commit

Permalink
Auto merge of #123266 - RalfJung:catch-panic, r=workingjubilee
Browse files Browse the repository at this point in the history
catch_panic: warn about panicking payload drop

Warns about the footgun in #86027.

Will be unnecessary if panics escaping from drop leads to abort (rust-lang/rfcs#3288). But until that is enforced everywhere, let's warn users about this.
  • Loading branch information
bors committed Mar 31, 2024
2 parents bf71dae + 42972f5 commit 204805a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/std/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
/// ```
Expand Down

0 comments on commit 204805a

Please sign in to comment.