-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unpin references #51935
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
Unpin references #51935
Conversation
These don'town the backing storage for their data, so projecting `PinMut` into their fields is already unsound.
These types never project pinned-ness into their contents, so it is safe for them to be `Unpin`.
@bors r+ I agree |
📌 Commit a2b21e5 has been approved by |
I am fairly dubious of any data structure that would claim to safely project through raw pointers; I suppose you could create an adequate API but it seems suspicious to claim to pin project through a pointer. So I wouldn't mind the raw pointers impls either. But I also think its fine to not have them, maybe better, just to make people implementing data structures actually think about it. |
LGTM (the reference part, I don't know The relevant property here is that from a Note that this would be implementable fairly easily using |
Pretty high, unfortunately-- @aturon already did it once ;). I think this might be worth explicitly noting in the docs of |
Might it be a good idea to have a macro in libstd that generates a Then we could add big fat warnings in the |
@RalfJung I could also imagine adding a clippy lint against a deref inside of a |
Unpin references I also considered adding an impl for raw pointers as well, but that makes it easy to accidentally have unsound owning-collections that might otherwise be able to project pinned-ness (e.g. `Box`). cc @RalfJung r? @withoutboats
☀️ Test successful - status-appveyor, status-travis |
I also considered adding an impl for raw pointers as well, but that makes it easy to accidentally have unsound owning-collections that might otherwise be able to project pinned-ness (e.g.
Box
).cc @RalfJung
r? @withoutboats