Skip to content

Commit

Permalink
Rollup merge of rust-lang#130526 - eholk:pin-reborrow, r=compiler-errors
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
GuillaumeGomez authored Sep 20, 2024
2 parents 97c4937 + 7b1c5e8 commit 25ab8ef
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 25ab8ef

Please sign in to comment.