-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
tokio: add asserts for unwind safety auto traits #7487
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
base: master
Are you sure you want to change the base?
Conversation
Add tests for UnwindSafe and RefUnwindSafe in async_send_sync.rs Fixes: tokio-rs#7413
Both |
Sigh ... parking_lot strikes again. What types have a difference with parking_lot and miri? |
We had issues with this previously for |
The solution here is probably to change some types in I would not look at miri until we address parking_lot. I suspect it may be the same issue. |
Adjust `tokio/tests/async_send_sync.rs` tests to correctly assert `UnwindSafe` and `RefUnwindSafe`. Remove `Cell` from example type since it was causing differences just because it contained `UnsafeCell` and we are aiming to test traits.
As suggested, I changed the types in |
@hawkw Are you able to comment on the unwind safety of |
@@ -29,6 +30,7 @@ pub(crate) struct LinkedList<L, T> { | |||
|
|||
unsafe impl<L: Link> Send for LinkedList<L, L::Target> where L::Target: Send {} | |||
unsafe impl<L: Link> Sync for LinkedList<L, L::Target> where L::Target: Sync {} | |||
impl<L: Link> UnwindSafe for LinkedList<L, L::Target> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the linked list is just raw pointers, having manual impls for both traits is probably the right call.
How should we continue with this? Should I add second impl for linked list and guard tests for types containing |
Add tests for UnwindSafe and RefUnwindSafe in async_send_sync.rs
Fixes: #7413
Motivation
We want to avoid unintentionally changing
UnwindSafe
andRefUnwindSafe
auto traits in public types.Solution
Add
UnwindSafe
andRefUnwindSafe
to already checked auto traits intokio/tests/async_send_sync.rs
. Fortokio::process::Command
those autotraits differ between windows and unix, so it was moved to new os specific sections.