-
Notifications
You must be signed in to change notification settings - Fork 30
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
Loosen Send
/Sync
bounds on futures
#48
Conversation
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.
LGTM otherwise.
76430c6
to
01908f6
Compare
01908f6
to
47a6cda
Compare
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.
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.
I'm not sure if this is the right approach. I'd prefer to modify the underlying Future
types in order to make the trait resolver automatically classify them as Sync
. If they contain types that aren't Send
/Sync
(like raw pointers) then those types should be wrapped to make them Send
/Sync
.
Instead of this:
struct Foo {
data: *const (),
other_data: u32
}
unsafe impl Send for Foo {}
I would do this:
struct Foo {
data: PtrWrapper,
other_data: u32
}
struct PtrWrapper(*const ());
unsafe impl Send for PtrWrapper {}
This ensures that `Send`/`Sync` bounds for each future match those of the value produed by the future.
47a6cda
to
030ca55
Compare
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.
Thanks!
This ensures that
Send
/Sync
bounds for each future match those of the value produed by the future.