Skip to content

Can't install tokio async await ( LocalWaker ) #908

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

Closed
victordtrr opened this issue Feb 20, 2019 · 7 comments · Fixed by #919
Closed

Can't install tokio async await ( LocalWaker ) #908

victordtrr opened this issue Feb 20, 2019 · 7 comments · Fixed by #919

Comments

@victordtrr
Copy link

Version

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 (
)

Platform

Linux 4.13.0-kali1-amd64 #1 SMP Debian 4.13.10-1kali2 (2017-11-08) x86_64 GNU/Linux

Description

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.

@victordtrr victordtrr changed the title Can't install tokia async await ( LocalWaker ) Can't install tokio async await ( LocalWaker ) Feb 20, 2019
@fmckeogh
Copy link

LocalWaker was removed in PR rust-lang/rust#57992, as discussed in rust-lang/rfcs#2592.

@victordtrr
Copy link
Author

Exact so I presume Async Await is dead for the moment ? Do you have a work around ?

@fmckeogh
Copy link

fmckeogh commented Feb 20, 2019

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).

@dvc94ch
Copy link

dvc94ch commented Feb 21, 2019

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());
}

@victordtrr
Copy link
Author

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.

@dvc94ch
Copy link

dvc94ch commented Feb 22, 2019

@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()

carllerche pushed a commit that referenced this issue Feb 22, 2019
- Rewrite noop_waker with items from the new API and replaces
  LocalWaker with Waker.

- Bump the minimum required version for `tokio-async-await` to
  1.34.0-nightly.

- `Unpin` was added to std prelude.

- Add `cargo check` to .travis.yml

Fixes: #908
@carllerche
Copy link
Member

Pushed out a release w/ the fix. Thanks @taiki-e

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

Successfully merging a pull request may close this issue.

4 participants