Skip to content
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

Open
3 of 12 tasks
traviscross opened this issue Sep 17, 2024 · 1 comment
Open
3 of 12 tasks

Tracking issue for pin ergonomics #130494

traviscross opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
B-experimental Blocker: In-tree experiment; RFC pending, not yet approved or unneeded. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. F-pin_ergonomics `#![feature(pin_ergonomics)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@traviscross
Copy link
Contributor

traviscross commented Sep 17, 2024

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

Unresolved Questions

TODO.

Related

TODO.

cc @eholk @rust-lang/lang

@traviscross traviscross added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. I-lang-nominated Nominated for discussion during a lang team meeting. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Sep 17, 2024
@traviscross traviscross changed the title Tracking Issue for pin ergonomics Tracking issue for pin ergonomics Sep 17, 2024
@traviscross traviscross added the B-experimental Blocker: In-tree experiment; RFC pending, not yet approved or unneeded. label Sep 18, 2024
@jieyouxu jieyouxu added the F-pin_ergonomics `#![feature(pin_ergonomics)]` label Sep 19, 2024
@traviscross
Copy link
Contributor Author

We accepted this experiment in the 2024-09-18 lang triage meeting.

Thanks to @eholk for pushing this forward.

@traviscross traviscross removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Sep 20, 2024
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`
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`
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. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. F-pin_ergonomics `#![feature(pin_ergonomics)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants