2024-09-04 16:03:47 -07:00
|
|
|
//@ check-pass
|
|
|
|
|
|
|
|
#![feature(pin_ergonomics)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
use std::pin::Pin;
|
|
|
|
|
2024-09-19 17:23:46 -07:00
|
|
|
pub struct Foo;
|
2024-09-04 16:03:47 -07:00
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
fn foo(self: Pin<&mut Self>) {
|
|
|
|
}
|
2024-09-19 17:23:46 -07:00
|
|
|
|
|
|
|
fn baz(self: Pin<&Self>) {
|
|
|
|
}
|
2024-09-04 16:03:47 -07:00
|
|
|
}
|
|
|
|
|
2024-09-19 17:23:46 -07:00
|
|
|
pub fn bar(x: Pin<&mut Foo>) {
|
2024-09-04 16:03:47 -07:00
|
|
|
x.foo();
|
|
|
|
x.foo(); // for this to work we need to automatically reborrow,
|
|
|
|
// as if the user had written `x.as_mut().foo()`.
|
2024-09-19 17:23:46 -07:00
|
|
|
|
|
|
|
Foo::baz(x);
|
|
|
|
|
2024-09-19 19:35:01 -07:00
|
|
|
x.baz();
|
2024-09-19 17:23:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn baaz(x: Pin<&Foo>) {
|
|
|
|
x.baz();
|
|
|
|
x.baz();
|
2024-09-04 16:03:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|