Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
taiki-e opened this issue May 9, 2019 · 4 comments
Closed
Labels
A-async-await Area: Async & Await C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@taiki-e
Copy link
Member

taiki-e commented May 9, 2019

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

@taiki-e
Copy link
Member Author

taiki-e commented May 9, 2019

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

@rustbot rustbot added A-async-await Area: Async & Await T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 9, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label May 9, 2019
@taiki-e
Copy link
Member Author

taiki-e commented May 9, 2019

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.

@taiki-e taiki-e 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 May 9, 2019
@cramertj
Copy link
Member

cramertj commented May 9, 2019

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

@cramertj
Copy link
Member

cramertj commented May 9, 2019

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

Centril added a commit to Centril/rust that referenced this issue May 9, 2019
…akis,Centril

Remove the old await! macro

This doesn't work anymore, and its continued presence is cause for confusion. `yield` can no longer be used to return `Pending` from an `async` body.

cc rust-lang#60660
cc @taiki-e
cc tokio-rs/tokio#1080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants