Skip to content
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

Can not build for #![feature(async_closure)] #290

Closed
boundless-forest opened this issue Jul 16, 2019 · 5 comments
Closed

Can not build for #![feature(async_closure)] #290

boundless-forest opened this issue Jul 16, 2019 · 5 comments

Comments

@boundless-forest
Copy link

Question

Environment:

os: Ubuntu 18.04
rust version: rustc 1.38.0-nightly (4b65a86eb 2019-07-15

Problem:

   Compiling tide v0.2.0
error[E0658]: async closures are unstable
   --> /home/wpf/.cargo/registry/src/github.com-1ecc6299db9ec823/tide-0.2.0/src/app.rs:312:28
    |
312 |         router.at("/").get(async move |_| "/");
    |                            ^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/62290
    = help: add `#![feature(async_closure)]` to the crate attributes to enable

Additional context

I had tried as compiler prompt but it not works.

#![feature(async_closure)]

fn main() {
    println!("Hello, world!");
}

@fairingrey
Copy link
Contributor

As follows #289, the async closure feature has been removed from the library -- but you can essentially have the same behavior through just passing in a regular closure and putting your logic into an async move block.

This will likely be the recommended way to do it for now, until the status of that feature changes

@taiki-e
Copy link
Contributor

taiki-e commented Jul 16, 2019

I think we need to release the next version (because tide 0.2 uses it and cannot be compiled in nightly-2019-07-08 or later.). but probably that blocked by next release of http-service (see #288 (comment))

cc @yoshuawuyts

@taiki-e
Copy link
Contributor

taiki-e commented Jul 16, 2019

Also, by copying the following block to your Cargo.toml, you can prepare for the new release.

[patch.crates-io]
tide = { git = "https://github.com/rustasync/tide", branch = "master" }
http-service = { git = "https://github.com/rustasync/http-service", branch = "master" }
http-service-hyper = { git = "https://github.com/rustasync/http-service", branch = "master" }
http-service-mock = { git = "https://github.com/rustasync/http-service", branch = "master" }

@boundless-forest
Copy link
Author

Also, by copying the following block to your Cargo.toml, you can prepare for the new release.

[patch.crates-io]
tide = { git = "https://github.com/rustasync/tide", branch = "master" }
http-service = { git = "https://github.com/rustasync/http-service", branch = "master" }
http-service-hyper = { git = "https://github.com/rustasync/http-service", branch = "master" }
http-service-mock = { git = "https://github.com/rustasync/http-service", branch = "master" }

Thank you !! It works.

@Vermistuk
Copy link

This took me a good while to find and was exactly what I needed.

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

No branches or pull requests

4 participants