-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Ensure std::mem::Discriminant is Send + Sync #45095
Conversation
r? @BurntSushi (rust_highfive has picked a reviewer for you, use r? to override) |
Tracking issue #24263 |
As discussed before on irc, a bit unclear what the correct phantom data really is for this thing. |
`PhantomData<*const T>` has the implication of Send / Syncness following the *const T type, but the discriminant should always be Send and Sync. Use `PhantomData<fn() -> T>` which has the same variance in T, but is Send + Sync
692a18d
to
3fff2d9
Compare
I am throwing this to @aturon. I don't immediately see anything wrong with this, but I'd like someone else to see it! cc @rust-lang/libs |
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.
What are the tradeoffs of using a screwy PhantomData marker vs unsafe impl Send
?
Sometimes I wish we had a few additional marker structs so we could do:
|
Looks good to me! @dtolnay I think the usage of |
Just a note that @aturon is on PTO this week so isn't likely to get to it, but it looks like this one is worth waiting for him to take a look. |
I'm gonna go ahead and approve this as I think there won't be too much opposition, and we'll have a long time on nightly before this reaches stable as well! |
@bors: r+ |
📌 Commit 3fff2d9 has been approved by |
…xcrichton Ensure std::mem::Discriminant is Send + Sync `PhantomData<*const T>` has the implication of Send / Syncness following the *const T type, but the discriminant should always be Send and Sync. Use `PhantomData<fn() -> T>` which has the same variance in T, but is Send + Sync
PhantomData<*const T>
has the implication of Send / Syncness followingthe *const T type, but the discriminant should always be Send and Sync.
Use
PhantomData<fn() -> T>
which has the same variance in T, but is Send + Sync