futures-await
futures-await copied to clipboard
`await` is ambiguous after updated to nightly-2018-06-24 and after
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 ofawait
to disambiguate
Can you try use futures::prelude::{async, await};
instead?
Well, that doesn't seem to be working any more.
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.
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.
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_!
.
A temporary workaround:
$ rustup override set nightly-2018-07-10
$ cargo update -p proc-macro2:0.4.8 --precise 0.4.6
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.
Sorry, the feature is called use_extern_macros
not use_extern_crate
, I am sort of sleep deprived
@withoutboats : Thank you! I will try it out. Go get some sleep, our future async world depends on you (:
Yes, adding #![feature(use_extern_macros)]
seems to work.
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)
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)
@xxks-kkk are you calling await inside of a function tagged #[async]
?