External Publication
Visit Post

Code bloat caused by lack of nounwind attr on `drop_in_place`

Rust Internals [Unofficial] April 16, 2026
Source

Hang on, is panicking in Drop actually guaranteed not to unwind? Panicking during unwinding results in an abort, which means panic-in-Drop is ill-advised, but I'm not sure the language has actually ruled it out.

Nothing in

  • Panic - The Rust Reference
  • Drop in std::ops - Rust
  • Destructors - The Rust Reference
  • panic in std - Rust

even mentions that panicking while already unwinding results in an abort, let alone that panicking in Drop is always forbidden. Thus, as far as I can tell, panicking in Drop is legal, as long as it never happens in practice while another panic is being processed. (But hopefully I've just missed the appropriate reference!)

Discussion in the ATmosphere

Loading comments...