-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Removed std::r#await
macro causes compilation fail
#1087
Comments
I locally worked around this with the following change. It's enough for getting my code to run (using the futures 0.3 -> 0.1 conversions), but the async/await examples in tokio are failing to compile. That's why I didn't send a PR. diff --git a/tokio-futures/src/await.rs b/tokio-futures/src/await.rs
index 1e8f6e7..c357539 100644
--- a/tokio-futures/src/await.rs
+++ b/tokio-futures/src/await.rs
@@ -1,16 +1,15 @@
/// Wait for a future to complete.
#[macro_export]
-macro_rules! await {
+macro_rules! r#await {
($e:expr) => {{
#[allow(unused_imports)]
use $crate::compat::backward::IntoAwaitable as IntoAwaitableBackward;
#[allow(unused_imports)]
use $crate::compat::forward::IntoAwaitable as IntoAwaitableForward;
- use $crate::std_await;
#[allow(unused_mut)]
let mut e = $e;
let e = e.into_awaitable();
- std_await!(e)
+ e.await
}};
}
diff --git a/tokio-futures/src/lib.rs b/tokio-futures/src/lib.rs
index 411dc42..fdf709d 100644
--- a/tokio-futures/src/lib.rs
+++ b/tokio-futures/src/lib.rs
@@ -28,8 +28,3 @@ pub mod compat;
pub mod io;
pub mod sink;
pub mod stream;
-
-// Rename the `await` macro in `std`. This is used by the redefined
-// `await` macro in this crate.
-#[doc(hidden)]
-pub use std::await as std_await;
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs
index 872f23c..8b89a83 100644
--- a/tokio/src/lib.rs
+++ b/tokio/src/lib.rs
@@ -1,5 +1,5 @@
#![doc(html_root_url = "https://docs.rs/tokio/0.1.19")]
-#![deny(missing_docs, warnings, missing_debug_implementations)]
+#![deny(missing_docs, missing_debug_implementations)]
#![cfg_attr(feature = "async-await-preview", feature(async_await, await_macro))]
//! A runtime for writing reliable, asynchronous, and slim applications. |
Thanks for the report. Progress is ongoing to address the issue (see above). However, the fixes will not be applied to the 0.1 branch. For the immediate future, to track the latest async / await changes with Tokio, using the version off of the git master branch will be required. |
For the time being, https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures/compat/index.html might be useful then, and removing the translation layer from tokio 0.1 to prevent confusion. |
**Note:** Also had to switch to tokio master thanks to [this](tokio-rs/tokio#1087 (comment)).
**Note:** Also had to switch to tokio master thanks to [this](tokio-rs/tokio#1087 (comment)).
Both had to happen at the same time, because recent nightly compilers don't have an std::await macro for Tokio to take over, and thus don't compile tokio's async-await-preview feature. Per tokio-rs/tokio#1087 (comment), development is being done on the master branch instead. There are a couple new `Box`es being made since I changed some .map()s into more readable async closures, which are unfortunately never `Unpin`. I also hit an internal compiler error in rustc 1.37.0-nightly (7840a0b75 2019-05-31) by missing the `mut` in the function signature of X11Events::read_exact. I probably would have been completely lost without https://rust-lang-nursery.github.io/futures-rs/blog/2019/04/18/compatibility-layer.html.
Version
Platform
Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:49:07 PDT 2019; root:xnu-4903.261.4~4/RELEASE_X86_64 x86_64
Subcrates
tokio-futures
Description
Running with latest nightly, the compilation of
tokio-async-await
fails, as thestd::r#await
macro which is being rexported has been deleted in this commit: rust-lang/rust#60675.I expected to see this happen:
Instead, this happened:
-->
The text was updated successfully, but these errors were encountered: