Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnwindSafe is unrelated to unsafe/rust safety. #6

Open
rustonaut opened this issue Nov 10, 2022 · 0 comments
Open

UnwindSafe is unrelated to unsafe/rust safety. #6

rustonaut opened this issue Nov 10, 2022 · 0 comments

Comments

@rustonaut
Copy link

rustonaut commented Nov 10, 2022

I might be worth to more clear point out that UnwindSafe is misleading, in that it is unrelated to unsafe/rust safety guarantees.

I.e. your type must be rust-safe to reuse after a catch_unwind no matter weather it implements UnwindSafe or not. If it's not it is unsound. Something which is often missed.

UnwindSafe is more like a marker indicating that something plays well with unwinding, instead of it being "rust-safe" wrt. unwinding.

To make things worse it is relatively easy to have code which doesn't play well with unwinding, but does accidentally implement UnwindSafe due *mut T being UnwindSafe if T: RefUnwindSafe... (it is that way due to *mut T often being an owning pointer, but if it's used for a &mut T-like thing you have to explicitly remember to disable it's UnwindSafe implementation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant