rust/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
585 B
Rust
Raw Normal View History

2024-09-20 19:09:18 +00:00
#![allow(dead_code)]
use std::pin::Pin;
struct Foo;
2024-09-20 02:35:01 +00:00
impl Foo {
fn foo(self: Pin<&mut Self>) {
}
}
2024-09-20 19:09:18 +00:00
fn foo(x: Pin<&mut Foo>) {
let _y: &pin mut Foo = x; //~ ERROR pinned reference syntax is experimental
}
2024-09-20 19:09:18 +00:00
fn foo_sugar(_: &pin mut Foo) {} //~ ERROR pinned reference syntax is experimental
fn bar(x: Pin<&mut Foo>) {
foo(x);
foo(x); //~ ERROR use of moved value: `x`
}
2024-09-20 02:35:01 +00:00
fn baz(mut x: Pin<&mut Foo>) {
x.foo();
2024-09-20 02:35:01 +00:00
x.foo(); //~ ERROR use of moved value: `x`
}
2024-09-20 19:09:18 +00:00
fn baz_sugar(_: &pin const Foo) {} //~ ERROR pinned reference syntax is experimental
fn main() {}