7b7992fbcf
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).
25 lines
442 B
Rust
25 lines
442 B
Rust
//@ check-pass
|
|
//@ignore-test
|
|
|
|
// Currently ignored due to self reborrowing not being implemented for Pin
|
|
|
|
#![feature(pin_ergonomics)]
|
|
#![allow(incomplete_features)]
|
|
|
|
use std::pin::Pin;
|
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
fn foo(self: Pin<&mut Self>) {
|
|
}
|
|
}
|
|
|
|
fn bar(x: Pin<&mut Foo>) {
|
|
x.foo();
|
|
x.foo(); // for this to work we need to automatically reborrow,
|
|
// as if the user had written `x.as_mut().foo()`.
|
|
}
|
|
|
|
fn main() {}
|