Skip to content

std::r#await! macro cannot be used even if #![feature(await_macro)] is enabled #60660

Description

@taiki-e

Code:

#![feature(async_await, await_macro)]

use std::r#await as std_await;

async fn foo() {}

async fn bar() {
    std_await!(foo())
}

Error:

error[E0658]: macro std_await! is unstable
 --> code\src\lib.rs:8:5
  |
8 |     std_await!(noop())
  |     ^^^^^^^^^^^^^^^^^^
  |
  = 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
 --> code\src\lib.rs:7:16
  |
7 |   async fn foo() {
  |  ________________^
8 | |     std_await!(noop())
9 | | }
  | |_^

error: aborting due to 2 previous errors

Seems the second error relates to the fact that std::await is still defined using yield.

Rustc version: rustc 1.36.0-nightly (3f5152e 2019-05-08)

cc @cramertj

Activity

  1. taiki-e commented on May 9, 2019

    @taiki-e
    MemberAuthor

    @rustbot modify labels: A-async-await, T-compiler.

  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on May 9, 2019
  3. taiki-e commented on May 9, 2019

    @taiki-e
    MemberAuthor

    Reduced:

    #![feature(async_await, await_macro)]
    
    async fn foo() {}
    
    async fn bar() {
        std::r#await!(foo())
    }
    

    Seems the actual problem is not about importing but using std::r#await.

  4. changed the title [-]If import await! macro as another name, it cannot be used even if #![feature(await_macro)] is enabled[/-] [+]std::r#await! macro cannot be used even if #![feature(await_macro)] is enabled[/+] on May 9, 2019
  5. cramertj commented on May 9, 2019

    @cramertj
    Member

    Yeah, I wouldn't expect the old macro to work anymore-- intentionally.

  6. cramertj commented on May 9, 2019

    @cramertj
    Member

    Opened #60675 to remove the old macro to prevent further confusion.

  7. added a commit that references this issue on May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions