Tide: Can not build for `#![feature(async_closure)]`

Created on 16 Jul 2019  路  5Comments  路  Source: http-rs/tide

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!");
}

Most helpful comment

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" }

All 5 comments

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

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 https://github.com/rustasync/tide/pull/288#issuecomment-511214379)

cc @yoshuawuyts

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" }

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bfrog picture bfrog  路  6Comments

cquintana-verbio picture cquintana-verbio  路  6Comments

lichr picture lichr  路  4Comments

realcr picture realcr  路  4Comments

alexreg picture alexreg  路  5Comments