-
Couldn't load subscription status.
- Fork 13.9k
Description
The current version of the std::thread::Result documentation recommends unwrapping a Result<T, Box<dyn Any + ...>> in order to re-start propagation of a caught panic. This recommendation will not simply resume the panic as it was originally. Once the error type has been erased and Boxed the panic can no longer be downcast directly back to the actual payload type. Instead you have to also try downcasting twice.
std::panic::catch_unwind on the other hand has no references to resume_unwind or how to repropagate caught panics at all, which ends up pushing users into the std::thread::Result if they're trying to figure out how to handle the Err variant of catch_unwind.
These docs should reference resume_unwind as the recommended way for re-propagating type erased panic payloads.