rust/tests/ui/async-await/issue-108572.rs
Esteban Küber 2c3fd1a23a Suggest pin!() instead of Pin::new() when appropriate
When encountering a type that needs to be pinned but that is `!Unpin`,
suggest using the `pin!()` macro.

Fix #57994.
2023-08-14 19:41:57 +00:00

16 lines
362 B
Rust

// edition: 2021
// run-rustfix
#![allow(unused_must_use, dead_code)]
use std::future::Future;
fn foo() -> impl Future<Output=()> {
async { }
}
fn bar(cx: &mut std::task::Context<'_>) {
let fut = foo();
fut.poll(cx);
//~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
}
fn main() {}