-
Notifications
You must be signed in to change notification settings - Fork 13k
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 changes #50984
Unpin changes #50984
Conversation
lgtm |
@bors: r+ (There should be plenty of time for further comments before this actually gets to the front of the queue...) |
📌 Commit 15d2f96 has been approved by |
👍 |
@@ -269,6 +270,15 @@ impl<T> Option<T> { | |||
} | |||
} | |||
|
|||
/// Converts from `Option<T>` to `Option<PinMut<'_, T>>` |
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 think this should say "from PinMut<'_, Option<T>
to".
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.
If this is the case, we should better change the docs of as_ref()
and as_mut()
as well.
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.
Good point. I think that would make sense, though.
This fixes the pinned invariant for |
@RalfJung Yes, this does fix that invariant-- i'm also interested in doing the same for other structures in std, such as AssertUnwindSafe, |
@cramertj One thing @RalfJung and I discussed was that there should still be a way to unsafely implement I don't think I have any concerns about this change otherwise, conceptually. However, I am a little wary about this implementation (just marking it safe) because unlike |
Why |
@RalfJung Why would |
I would usually expect that when something is pinned, that is a statement about the memory this thing is allocated in -- which doesn't propagate through pointers. Also see the discussion at #49621. |
@RalfJung Yes, that intuition makes sense. I had a different intuition, though-- I was thinking of I lean slightly towards my original intuition (single-field wrapper with out-of-line storage) because it allows more broad trait impls and makes more code that expects to be able to project |
Unpin changes r? @aturon cc @withoutboats, @RalfJung, @pythonesque, #49150
☀️ Test successful - status-appveyor, status-travis |
r? @aturon
cc @withoutboats, @RalfJung, @pythonesque, #49150