It’s safe to use a Mutex in a catch_unwind because it implements poisoning. There is very little rationale about what can or cannot be passed across catch_unwind, but one thing is clear to me: RefCell is the singlethreaded equivalent of Mutex, but it doesn’t have poisoning, so an unwind would drop the locks and leave the contents in a potentially unsafe state.
But: Cell is very different!
Cell types come in two flavors:
Cell<T>implements interior mutability by moving values in and out of the
Cell<T>. To use references instead of values, one must use the
RefCell<T>type, acquiring a write lock before mutating.
Cell can never be in an “unsafe” state, because either you fully move into it, or fully move out of it. So it makes no sense that Cell can’t be used across catch_unwind? idk.
am I missing something?