Following this page and from a new cargo init :
https://github.com/tokio-rs/tokio/tree/master/tokio-async-await
testing_tokio v0.1.0 (/root/testing_tokio)
โโโ tokio v0.1.15
โโโ tokio-async-await v0.1.5
โ โโโ tokio-io v0.1.11
โโโ tokio-codec v0.1.1
โ โโโ tokio-io v0.1.11 ()
โโโ tokio-current-thread v0.1.4
โ โโโ tokio-executor v0.1.6
โโโ tokio-executor v0.1.6 ()
โโโ tokio-fs v0.1.5
โ โโโ tokio-io v0.1.11 ()
โ โโโ tokio-threadpool v0.1.11
โ โโโ tokio-executor v0.1.6 ()
โ โโโ tokio-io v0.1.11 ()
โโโ tokio-io v0.1.11 ()
โโโ tokio-reactor v0.1.8
โ โโโ tokio-executor v0.1.6 ()
โ โโโ tokio-io v0.1.11 ()
โโโ tokio-sync v0.1.1
โโโ tokio-tcp v0.1.3
โ โโโ tokio-io v0.1.11 ()
โ โโโ tokio-reactor v0.1.8 ()
โโโ tokio-threadpool v0.1.11 ()
โโโ tokio-timer v0.2.10
โ โโโ tokio-executor v0.1.6 ()
โโโ tokio-udp v0.1.3
โ โโโ tokio-codec v0.1.1 ()
โ โโโ tokio-io v0.1.11 ()
โ โโโ tokio-reactor v0.1.8 ()
โโโ tokio-uds v0.2.5
โโโ tokio-codec v0.1.1 ()
โโโ tokio-io v0.1.11 ()
โโโ tokio-reactor v0.1.8 ()
Linux 4.13.0-kali1-amd64 #1 SMP Debian 4.13.10-1kali2 (2017-11-08) x86_64 GNU/Linux
I am simply following the exemple. Nothing more. And I have the following issue during the build :
Compiling tokio-async-await v0.1.5
error[E0432]: unresolved importstd::task::LocalWaker
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-async-await-0.1.5/src/compat/forward.rs:7:17
|
7 | use std::task::{LocalWaker, Poll as StdPoll};
| ^^^^^^^^^^ noLocalWakerintask
Seems to be relate with Future issue about LocalWaker ...
Thank you.
LocalWaker was removed in PR https://github.com/rust-lang/rust/pull/57992, as discussed in https://github.com/rust-lang/rfcs/pull/2592.
Exact so I presume Async Await is dead for the moment ? Do you have a work around ?
The workaround will be to use an older nightly. We'll need to discuss with tokio-rs members as to what to do (reimplement with the newer API (https://github.com/aturon/rfcs/blob/future/text/0000-futures.md#rationale-drawbacks-and-alternatives-to-the-wakeup-design-waker?), or some other fix).
Using an older nightly breaks other crates. As a work around you can do this:
[dependencies]
futures-preview = { version = "0.3.0-alpha.13", features = ["compat"] }
tokio = "*"
#![features(async_await, await_macro, futures_api)]
use futures::future::FutureObj;
use futures::prelude::*;
fn main() {
tokio::run(FutureObj::new(Box::new(async move {
println!("running");
tokio::spawn(FutureObj::new(Box::new(async move {
println!("spawned");
Ok(())
})).compat());
Ok(())
})).compat());
}
Thank you David for the work around. The issue is I can't even build. Do you have a specific .toml according to it ?
@taiki-e seems to be the Real MVP here. I hope your PR will be accepted !
Thanks everyone for your help in this issue.
@victordetarragon tokio-async-await provides a tokio::run_async and tokio::spawn_async which take v3 Futures. By using the compat traits from futures-preview you can roll your own until it builds again. I updated the comment with a Cargo.toml and verified that the code example runs as is.
If you are returning futures from trait functions you need to wrap them in FutureObj<Box<F: Future>> anyway, so you most likely already have FutureObj<Box<F: Future>> anyway. All that is missing is calling compat()
Pushed out a release w/ the fix. Thanks @taiki-e
Most helpful comment
The workaround will be to use an older nightly. We'll need to discuss with
tokio-rsmembers as to what to do (reimplement with the newer API (https://github.com/aturon/rfcs/blob/future/text/0000-futures.md#rationale-drawbacks-and-alternatives-to-the-wakeup-design-waker?), or some other fix).