-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tracking issue for pin ergonomics #130494
Labels
B-experimental
Blocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stablize).
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
F-pin_ergonomics
`#![feature(pin_ergonomics)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
We accepted this experiment in the 2024-09-18 lang triage meeting. Thanks to @eholk for pushing this forward. |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Sep 20, 2024
Begin experimental support for pin reborrowing This commit adds basic support for reborrowing `Pin` types in argument position. At the moment it only supports reborrowing `Pin<&mut T>` as `Pin<&mut T>` by inserting a call to `Pin::as_mut()`, and only in argument position (not as the receiver in a method call). This PR makes the following example compile: ```rust #![feature(pin_ergonomics)] fn foo(_: Pin<&mut Foo>) { } fn bar(mut x: Pin<&mut Foo>) { foo(x); foo(x); } ``` Previously, you would have had to write `bar` as: ```rust fn bar(mut x: Pin<&mut Foo>) { foo(x.as_mut()); foo(x); } ``` Tracking: - rust-lang#130494 r? `@compiler-errors`
This was referenced Sep 20, 2024
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 20, 2024
Rollup merge of rust-lang#130526 - eholk:pin-reborrow, r=compiler-errors Begin experimental support for pin reborrowing This commit adds basic support for reborrowing `Pin` types in argument position. At the moment it only supports reborrowing `Pin<&mut T>` as `Pin<&mut T>` by inserting a call to `Pin::as_mut()`, and only in argument position (not as the receiver in a method call). This PR makes the following example compile: ```rust #![feature(pin_ergonomics)] fn foo(_: Pin<&mut Foo>) { } fn bar(mut x: Pin<&mut Foo>) { foo(x); foo(x); } ``` Previously, you would have had to write `bar` as: ```rust fn bar(mut x: Pin<&mut Foo>) { foo(x.as_mut()); foo(x); } ``` Tracking: - rust-lang#130494 r? `@compiler-errors`
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 2, 2024
…errors Add support for reborrowing pinned method receivers This builds on rust-lang#130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work: ```rust #![feature(pin_ergonomics)] #![allow(incomplete_features)] use std::pin::Pin; pub struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } fn baz(self: Pin<&Self>) { } } pub fn bar(x: Pin<&mut Foo>) { x.foo(); x.foo(); x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo> } pub fn baaz(x: Pin<&Foo>) { x.baz(); x.baz(); } ``` This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aa). rust-lang#130494 r? `@compiler-errors`
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Oct 5, 2024
…r-errors Add support for reborrowing pinned method receivers This builds on rust-lang#130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work: ```rust #![feature(pin_ergonomics)] #![allow(incomplete_features)] use std::pin::Pin; pub struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } fn baz(self: Pin<&Self>) { } } pub fn bar(x: Pin<&mut Foo>) { x.foo(); x.foo(); x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo> } pub fn baaz(x: Pin<&Foo>) { x.baz(); x.baz(); } ``` This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aa). rust-lang#130494 r? `@compiler-errors`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 5, 2024
Rollup merge of rust-lang#130633 - eholk:pin-reborrow-self, r=compiler-errors Add support for reborrowing pinned method receivers This builds on rust-lang#130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work: ```rust #![feature(pin_ergonomics)] #![allow(incomplete_features)] use std::pin::Pin; pub struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } fn baz(self: Pin<&Self>) { } } pub fn bar(x: Pin<&mut Foo>) { x.foo(); x.foo(); x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo> } pub fn baaz(x: Pin<&Foo>) { x.baz(); x.baz(); } ``` This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aa). rust-lang#130494 r? `@compiler-errors`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 15, 2024
…er-errors Add `&pin (mut|const) T` type position sugar This adds parser support for `&pin mut T` and `&pin const T` references. These are desugared to `Pin<&mut T>` and `Pin<&T>` in the AST lowering phases. This PR currently includes rust-lang#130526 since that one is in the commit queue. Only the most recent commits (bd45002 and following) are new. Tracking: - rust-lang#130494 r? `@compiler-errors`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 15, 2024
Rollup merge of rust-lang#130635 - eholk:pin-reborrow-sugar, r=compiler-errors Add `&pin (mut|const) T` type position sugar This adds parser support for `&pin mut T` and `&pin const T` references. These are desugared to `Pin<&mut T>` and `Pin<&T>` in the AST lowering phases. This PR currently includes rust-lang#130526 since that one is in the commit queue. Only the most recent commits (bd45002 and following) are new. Tracking: - rust-lang#130494 r? `@compiler-errors`
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Oct 18, 2024
…er-errors Add `&pin (mut|const) T` type position sugar This adds parser support for `&pin mut T` and `&pin const T` references. These are desugared to `Pin<&mut T>` and `Pin<&T>` in the AST lowering phases. This PR currently includes rust-lang#130526 since that one is in the commit queue. Only the most recent commits (bd45002 and following) are new. Tracking: - rust-lang#130494 r? `@compiler-errors`
This was referenced Jan 17, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 15, 2025
…, r=<try> Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Mar 5, 2025
…er, r=oli-obk Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Mar 5, 2025
…er, r=oli-obk Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
Noratrieb
added a commit
to Noratrieb/rust
that referenced
this issue
Mar 6, 2025
…er, r=oli-obk,traviscross Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this issue
Mar 6, 2025
…er, r=oli-obk,traviscross Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 7, 2025
Rollup merge of rust-lang#135733 - frank-king:feature/pin-self-receiver, r=oli-obk,traviscross Implement `&pin const self` and `&pin mut self` sugars This PR implements part of rust-lang#130494. It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
B-experimental
Blocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stablize).
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
F-pin_ergonomics
`#![feature(pin_ergonomics)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This is a tracking issue for work on pin ergonomics.
The feature gate for the issue is
#![feature(pin_ergonomics)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
&pin const
/&pin mut
constructor syntax in nightly.&pin const
/&pin mut
type syntax in nightly.&pin (mut|const) T
type position sugar #130635&pin const self
/&pin mut self
argument syntax in nightly.&pin const self
and&pin mut self
sugars #135733#[pin]
struct field annotations anddrop
changes in nightly.Pin
API.Unresolved Questions
TODO.
Related
TODO.
cc @eholk @rust-lang/lang
The text was updated successfully, but these errors were encountered: