Skip to content

Commit 05cbd44

Browse files
committed
Default all async support to std::future
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 #1558 Closes #1695
1 parent 777828a commit 05cbd44

33 files changed

+634
-1120
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ cfg-if = "0.1.9"
4343

4444
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
4545
js-sys = { path = 'crates/js-sys', version = '0.3.27' }
46-
wasm-bindgen-test = { path = 'crates/test', version = '=0.2.50' }
46+
wasm-bindgen-test = { path = 'crates/test', version = '=0.3.0' }
4747
serde_derive = "1.0"
4848
wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' }
4949
wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' }

azure-pipelines.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
displayName: "Run wasm-bindgen crate tests (unix)"
1010
steps:
1111
- template: ci/azure-install-rust.yml
12+
parameters:
13+
toolchain: nightly
1214
- template: ci/azure-install-node.yml
1315
- template: ci/azure-install-geckodriver.yml
1416
- template: ci/azure-install-sccache.yml
@@ -48,6 +50,8 @@ jobs:
4850
vmImage: vs2017-win2016
4951
steps:
5052
- template: ci/azure-install-rust.yml
53+
parameters:
54+
toolchain: nightly
5155
- template: ci/azure-install-node.yml
5256
- template: ci/azure-install-geckodriver.yml
5357
- template: ci/azure-install-sccache.yml
@@ -91,6 +95,8 @@ jobs:
9195
displayName: "Run web-sys crate tests"
9296
steps:
9397
- template: ci/azure-install-rust.yml
98+
parameters:
99+
toolchain: nightly
94100
- template: ci/azure-install-node.yml
95101
- template: ci/azure-install-geckodriver.yml
96102
- template: ci/azure-install-sccache.yml
@@ -104,6 +110,8 @@ jobs:
104110
displayName: "Run js-sys crate tests"
105111
steps:
106112
- template: ci/azure-install-rust.yml
113+
parameters:
114+
toolchain: nightly
107115
- template: ci/azure-install-node.yml
108116
- template: ci/azure-install-geckodriver.yml
109117
- template: ci/azure-install-sccache.yml
@@ -113,6 +121,8 @@ jobs:
113121
displayName: "Run wasm-bindgen-webidl crate tests"
114122
steps:
115123
- template: ci/azure-install-rust.yml
124+
parameters:
125+
toolchain: nightly
116126
- template: ci/azure-install-node.yml
117127
#- template: ci/azure-install-sccache.yml
118128
- script: cargo test -p wasm-bindgen-webidl
@@ -125,7 +135,7 @@ jobs:
125135
steps:
126136
- template: ci/azure-install-rust.yml
127137
parameters:
128-
toolchain: beta
138+
toolchain: nightly
129139
- template: ci/azure-install-node.yml
130140
- template: ci/azure-install-sccache.yml
131141
- script: cargo test -p wasm-bindgen-macro
@@ -156,6 +166,8 @@ jobs:
156166
displayName: "Build almost all examples"
157167
steps:
158168
- template: ci/azure-install-rust.yml
169+
parameters:
170+
toolchain: nightly
159171
- template: ci/azure-install-sccache.yml
160172
- template: ci/azure-install-wasm-pack.yml
161173
- script: mv _package.json package.json && npm install && rm package.json
@@ -177,7 +189,7 @@ jobs:
177189
steps:
178190
- template: ci/azure-install-rust.yml
179191
parameters:
180-
toolchain: nightly-2019-07-30
192+
toolchain: nightly-2019-08-27
181193
- template: ci/azure-install-sccache.yml
182194
- script: rustup component add rust-src
183195
displayName: "install rust-src"
@@ -198,6 +210,8 @@ jobs:
198210
displayName: "Build benchmarks"
199211
steps:
200212
- template: ci/azure-install-rust.yml
213+
parameters:
214+
toolchain: nightly
201215
- template: ci/azure-install-sccache.yml
202216
- template: ci/azure-install-wasm-pack.yml
203217
- script: wasm-pack build --target web benchmarks
@@ -263,7 +277,6 @@ jobs:
263277
- job: doc_book
264278
displayName: "Doc - build the book"
265279
steps:
266-
- template: ci/azure-install-rust.yml
267280
- script: |
268281
set -e
269282
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
@@ -279,6 +292,8 @@ jobs:
279292
displayName: "Doc - build the API documentation"
280293
steps:
281294
- template: ci/azure-install-rust.yml
295+
parameters:
296+
toolchain: nightly
282297
# Install rustfmt so we can format the web-sys bindings
283298
- script: rustup component add rustfmt
284299
displayName: "Install rustfmt"

crates/futures/Cargo.toml

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ license = "MIT/Apache-2.0"
77
name = "wasm-bindgen-futures"
88
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures"
99
readme = "./README.md"
10-
version = "0.3.27"
10+
version = "0.4.0"
1111
edition = "2018"
1212

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

2218
[target.'cfg(target_feature = "atomics")'.dependencies.web-sys]
2319
path = "../web-sys"
@@ -28,7 +24,5 @@ features = [
2824
]
2925

3026
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
31-
wasm-bindgen-test = { path = '../test', version = '0.2.50' }
32-
33-
[features]
34-
futures_0_3 = ["futures-util-preview", "futures-channel-preview", "lazy_static"]
27+
wasm-bindgen-test = { path = '../test', version = '0.3.0' }
28+
futures-channel-preview = { version = "0.3.0-alpha.18" }

0 commit comments

Comments
 (0)