Skip to content

Commit

Permalink
Default all async support to std::future
Browse files Browse the repository at this point in the history
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
  • Loading branch information
alexcrichton committed Aug 28, 2019
1 parent 777828a commit 5b3ca90
Show file tree
Hide file tree
Showing 31 changed files with 574 additions and 1,046 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cfg-if = "0.1.9"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
js-sys = { path = 'crates/js-sys', version = '0.3.27' }
wasm-bindgen-test = { path = 'crates/test', version = '=0.2.50' }
wasm-bindgen-test = { path = 'crates/test', version = '=0.3.0' }
serde_derive = "1.0"
wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' }
wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' }
Expand Down
11 changes: 2 additions & 9 deletions crates/futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ license = "MIT/Apache-2.0"
name = "wasm-bindgen-futures"
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures"
readme = "./README.md"
version = "0.3.27"
version = "0.4.0"
edition = "2018"

[dependencies]
cfg-if = "0.1.9"
futures = "0.1.20"
js-sys = { path = "../js-sys", version = '0.3.27' }
wasm-bindgen = { path = "../..", version = '0.2.50' }
futures-util-preview = { version = "0.3.0-alpha.18", optional = true }
futures-channel-preview = { version = "0.3.0-alpha.18", optional = true }
lazy_static = { version = "1.3.0", optional = true }

[target.'cfg(target_feature = "atomics")'.dependencies.web-sys]
path = "../web-sys"
Expand All @@ -28,7 +24,4 @@ features = [
]

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = { path = '../test', version = '0.2.50' }

[features]
futures_0_3 = ["futures-util-preview", "futures-channel-preview", "lazy_static"]
wasm-bindgen-test = { path = '../test', version = '0.3.0' }
274 changes: 0 additions & 274 deletions crates/futures/src/futures_0_3.rs

This file was deleted.

Loading

0 comments on commit 5b3ca90

Please sign in to comment.