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.
The current version of the
std::thread::Resultdocumentation recommends unwrapping aResult<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_unwindon the other hand has no references toresume_unwindor how to repropagate caught panics at all, which ends up pushing users into thestd::thread::Resultif they're trying to figure out how to handle theErrvariant ofcatch_unwind.These docs should reference
resume_unwindas the recommended way for re-propagating type erased panic payloads.