1
Fork 0
rust/compiler/rustc_feature/src
Guillaume Gomez fe5f734e6a
Rollup merge of #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:

- #130494

r? `@compiler-errors`
2024-09-20 19:46:38 +02:00
..
accepted.rs also stabilize const_refs_to_cell 2024-09-15 10:20:47 +02:00
builtin_attrs.rs Correctly handle stability of #[diagnostic] attributes 2024-09-06 19:01:45 +02:00
lib.rs Correctly handle stability of #[diagnostic] attributes 2024-09-06 19:01:45 +02:00
removed.rs replace placeholder version 2024-09-03 20:54:02 +01:00
tests.rs tidy: Re-enable check for inline unit tests 2020-12-12 19:18:44 +03:00
unstable.rs Rollup merge of #130526 - eholk:pin-reborrow, r=compiler-errors 2024-09-20 19:46:38 +02:00