diff options
| author | Ezra Shaw <ezrasure@outlook.com> | 2023-03-04 21:08:15 +1300 |
|---|---|---|
| committer | Ezra Shaw <ezrasure@outlook.com> | 2023-03-05 09:34:00 +1300 |
| commit | aaaffa9a3ee4851422ff435bf6b24dd2e55da171 (patch) | |
| tree | 0d621fbbcf645240df4ef06e24d679a14ad8b5b9 /tests/ui | |
| parent | 0fbfc3e76916521b509b63286296dd0762170d34 (diff) | |
| download | rust-aaaffa9a3ee4851422ff435bf6b24dd2e55da171.tar.gz rust-aaaffa9a3ee4851422ff435bf6b24dd2e55da171.zip | |
feat: impl better help for `.poll()` not found on `impl Future`
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/async-await/issue-108572.rs | 12 | ||||
| -rw-r--r-- | tests/ui/async-await/issue-108572.stderr | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs new file mode 100644 index 00000000000..efcb8b8ebab --- /dev/null +++ b/tests/ui/async-await/issue-108572.rs @@ -0,0 +1,12 @@ +// edition: 2021 + +use std::future::Future; +fn foo() -> impl Future<Output=()> { + async { } +} + +fn main() { + let fut = foo(); + fut.poll(); + //~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599] +} diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr new file mode 100644 index 00000000000..0dbcf4d660a --- /dev/null +++ b/tests/ui/async-await/issue-108572.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope + --> $DIR/issue-108572.rs:10:9 + | +LL | fut.poll(); + | ^^^^ method not found in `impl Future<Output = ()>` + | + = help: method `poll` found on `Pin<&mut impl Future<Output = ()>>`, see documentation for `std::pin::Pin` + = help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. |
