Skip to content

async/await: Compiler talks about async generators when the old await macro is used #60723

Closed
@Matthias247

Description

@Matthias247

This error confused me when trying to convert async/await code to latest nightly:

This function:

#![feature(async_await)] 

async fn produces_error() {
    r#await!(1);
}

produces the following diagnostic:

error[E0658]: macro r#await! is unstable
 --> src/lib.rs:4:5
  |
4 |     r#await!(1);
  |     ^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/50547
  = help: add #![feature(await_macro)] to the crate attributes to enable

error[E0727]: `async` generators are not yet supported
 --> src/lib.rs:3:27
  |
3 |   async fn produces_error() {
  |  ___________________________^
4 | |     r#await!(1);
5 | | }
  | |_^

error: aborting due to 2 previous errors

I was mostly confused what it had to do with async generators, since there is no generator involved. Tracking it back to the old await! wasn't obvious, since for my case that one was hidden in the "old" version of futures-rs select! macro. Thereby using select! lead to an error message which was hard to understand.

I guess this will go away once the old await macro is removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions