-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rename Pin to PinMut, and some more breaking changes #50497
Conversation
As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate. Given that, it seems desirable to at least eventually actually expose that typestate as a reference type. This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on. [1] https://www.ralfj.de/blog/2018/04/10/safe-intrusive-collections-with-pinning.html [2] rust-lang/rfcs#2349 (comment) [3] rust-lang#49150 (comment)
…fetime Suggested by @dylanede at <rust-lang#49150 (comment)>.
(rust_highfive has picked a reviewer for you, use r? to override) |
There are a few other breaking changes I'd like to see made to these APIs, and probably it makes sense to do them in the same merge. I could build off this, or you could if you're interested in @RalfJung. The main thing is changing the methods that currently take |
I actually already have this prepared for The only other candidate I can think of is |
One thing coming to my mind right now: Renaming |
I think |
calling it |
Done (the rename). As far as method syntax is concerned, I agree it is unlikely to conflict but is that good enough? OTOH, method syntax would be really useful here. I amended the commit to use |
📌 Commit 939c25a has been approved by |
This LGTM, although I'd really like to solidify what |
I'd think (but did not check in my model yet) that you can deref an |
@RalfJung I'm confused-- to me it seems like that conflicts with your previous statements about |
Those statements (IIRC) were made under the assumption that the model does not have a "shared pinned" typestate. I have two models of all of this in my head:
The statement above about dereferencing |
@RalfJung Ah, I was always assuming that we had "shared pinned" as a valid typestate-- that explains why I was so confused by your post on the subject. I never questioned that the typestate should exist, but rather whether it was necessary to include a built-in type for it (rather than just using |
@cramertj &Pin is really annoying to work with since you can't do field projections with it (because you need to get an |
@cramertj Also see #49150 (comment) where I essentially wrote what @pythonesque said above (I think @comex was the first to make this observation). |
You're both right, of course, and I've changed my mind after using it in practice 😄 |
Rename Pin to PinMut, and some more breaking changes As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate. Given that, it seems desirable to at least eventually actually expose that typestate as a reference type. This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on. [1] https://www.ralfj.de/blog/2018/04/10/safe-intrusive-collections-with-pinning.html [2] rust-lang/rfcs#2349 (comment) [3] #49150 (comment) Cc @withoutboats
☀️ Test successful - status-appveyor, status-travis |
As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate. Given that, it seems desirable to at least eventually actually expose that typestate as a reference type. This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on.
[1] https://www.ralfj.de/blog/2018/04/10/safe-intrusive-collections-with-pinning.html
[2] rust-lang/rfcs#2349 (comment)
[3] #49150 (comment)
Cc @withoutboats