-
Notifications
You must be signed in to change notification settings - Fork 19
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
Creating PhantomUnSend
and PhantomUnSync
#175
Comments
I like the symmetry with |
It seems like it's still far from stabilization |
I assume these would live in |
Unimportant bikeshedding: I'm not sure these are exactly "phantom"? Might be able to just call them |
What don't you think they're phantom? Phantom just means "zero sized", doesn't it? Phantom data, phantom pinned, etc |
My interpretation of "phantom data" was that it has "a ghost of a T".
But I guess |
Agreed |
This issue is receiving some new attention due to recent discussion. The reason is as follows. Right now people sometimes write We've never told people not to do this because all of the ways of expressing these things rely on using the implicit properties of core types. The problem is that any new property we might want to have pass through I.e., that fact that users are relying on |
I think I don't think we should use I think
|
Fair enough. That's a reasonable interpretation. Agreed definitely it should be |
@rustbot labels +I-nominated Nominating for T-libs-api discussion as this issue has been receiving renewed interest as described here. As we've been finding, not stabilizing these marker types is the opposite of conservative because it causes people to rely instead on the properties (and absence of properties) of existing types that aren't meant explicitly for this purpose, and that reliance inhibits language evolution. The proposal on the table is to add and then stabilize:
As part of this, and for the same reasons, T-libs-api might also consider adding and stabilizing:
|
it might be nice to also have |
We discussed this in the libs-api meeting last week. We would prefer a language-level solution based on negative impls which would allow you to explicitly implement |
Proposal
This would add the types
PhantomUnSend
andPhantomUnSync
, in the same style as thePhantomPinned
typeProblem statement
To mark a type as
!Send
or!Sync
, there is currently only two ways:negative_impls
featurePhantomData
of types that are!Send
ans/or!Sync
The first solution requires nightly, and the second one is unrellyable, since the implementation of the phantom type may change and make that type
Send
orSync
Motivation, use-cases
Current solution using
negative_impls
Current solution using
PhantomData
Solution sketches
What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.
The text was updated successfully, but these errors were encountered: