Uh oh!
There was an error while loading. Please reload this page.
Ensure std::mem::Discriminant is Send + Sync - #45095
Conversation
rust-highfive
commented
Oct 7, 2017
r? @BurntSushi (rust_highfive has picked a reviewer for you, use r? to override) |
bluss
commented
Oct 7, 2017
Tracking issue #24263 |
bluss
commented
Oct 7, 2017
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
3fff2d9CompareBurntSushi
commented
Oct 8, 2017
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 |
dtolnay
left a comment
There was a problem hiding this comment.
What are the tradeoffs of using a screwy PhantomData marker vs unsafe impl Send?
ghost
commented
Oct 8, 2017
Sometimes I wish we had a few additional marker structs so we could do: |
alexcrichton
commented
Oct 9, 2017
Looks good to me! @dtolnay I think the usage of |
carols10cents
commented
Oct 9, 2017
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. |
alexcrichton
commented
Oct 9, 2017
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! |
alexcrichton
commented
Oct 9, 2017
@bors: r+ |
bors
commented
Oct 9, 2017
📌 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