Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

await is ambiguous after updated to nightly-2018-06-24 and after #106

Open
shisoft opened this issue Jun 29, 2018 · 13 comments
Open

await is ambiguous after updated to nightly-2018-06-24 and after #106

shisoft opened this issue Jun 29, 2018 · 13 comments

Comments

@shisoft
Copy link

shisoft commented Jun 29, 2018

Hi,
It seems like the nightly rust have already built in await macro which conflict with this crate.
Is there any suggestion to resolve this problem before futures 0.3 was settled?

Thanks

error[E0659]: await is ambiguous
--> src/raft/client.rs:152:5
|
152 | #[async(boxed)]
| ^^^^^^^^^^^^^^^
|
note: await could refer to the name imported here
--> src/raft/client.rs:20:5
|
20 | use futures::prelude::*;
| ^^^^^^^^^^^^^^^^^^^
= note: await is also a builtin macro
= note: consider adding an explicit import of await to disambiguate

@lnicola
Copy link

lnicola commented Jul 3, 2018

Can you try use futures::prelude::{async, await}; instead?

@lnicola
Copy link

lnicola commented Jul 17, 2018

Well, that doesn't seem to be working any more.

@Nemo157
Copy link
Contributor

Nemo157 commented Jul 17, 2018

Just to make sure everyone coming here is aware, this is an incompatibility with the new builtin async/await support. I would have expected @lnicola's suggestion to work, but maybe there's some weird interaction between the implicit #[macro_use] extern crate std; and the use_extern_macro feature.

@lnicola
Copy link

lnicola commented Jul 17, 2018

It was working, but I updated today and now I'm getting:

error[E0658]: macro await! is unstable (see issue #50547)
   --> src/main.rs:111:20
    |
111 |     let mut file = await!(tokio::fs::File::open(path.clone()))?;
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(await_macro)] to the crate attributes to enable

Probably related to the proc-macro2 changes.

@withoutboats
Copy link
Collaborator

I would've thought they would be shadowed, but I guess that's not happening for some unclear reason. Only way I know to fix this would be to release a new version with this macro renamed to something like await_!.

@realcr
Copy link

realcr commented Jul 17, 2018

A temporary workaround:

$ rustup override set nightly-2018-07-10
$ cargo update -p proc-macro2:0.4.8 --precise 0.4.6

@withoutboats
Copy link
Collaborator

withoutboats commented Jul 17, 2018

Alex Crichton informs me that adding the use_extern_crate feature to your #![features()] list may, in the most recent nightly, make @lnicola's solution work.

@withoutboats
Copy link
Collaborator

Sorry, the feature is called use_extern_macros not use_extern_crate, I am sort of sleep deprived

@realcr
Copy link

realcr commented Jul 17, 2018

@withoutboats : Thank you! I will try it out. Go get some sleep, our future async world depends on you (:

@lnicola
Copy link

lnicola commented Jul 17, 2018

Yes, adding #![feature(use_extern_macros)] seems to work.

@rubdos
Copy link

rubdos commented Jul 20, 2018

Well, that doesn't seem to be working any more.

#![feature(use_extern_macros)]

(edit: Github was bugging, I didn't see the other comments and I cannot delete this one)

@xxks-kkk
Copy link

I tried the solution above, now I got

error[E0627]: yield statement outside of generator literal
   --> /home/zeyuanhu/rustfs/spdk-rs/src/bdev.rs:119:19
    |
119 |         let res = await!(receiver).expect("Cancellation is not supported");
    |                   ^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

My rustc version rustc 1.31.0-nightly (b2d6ea98b 2018-10-07)

@withoutboats
Copy link
Collaborator

@xxks-kkk are you calling await inside of a function tagged #[async]?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants