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 |
|
👍 |
| } | ||
| } | ||
|
|
||
| /// Converts from `Option<T>` to `Option<PinMut<'_, T>>` |
There was a problem hiding this comment.
I think this should say "from PinMut<'_, Option<T> to".
There was a problem hiding this comment.
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.
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