Skip to content

Commit b140c46

Browse files
committed
Fix dev-dependency WASM compilation issue
`futures-lite` in the dev dependencies added a `block_on` call that was not present in the WASM build, causing a compile error. This PR makes sure that the `std` feature of `futures-lite` is enabled in Cargo.toml. This also adds a CI check to ensure that this doesn't happen again Signed-off-by: John Nunley <[email protected]>
1 parent 1d4769a commit b140c46

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ jobs:
3838
- name: Install Rust
3939
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
4040
- run: rustup target add wasm32-unknown-unknown
41+
- uses: taiki-e/install-action@cargo-hack
4142
- run: cargo build --all --all-features --all-targets
4243
if: startsWith(matrix.rust, 'nightly')
4344
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
4445
if: startsWith(matrix.rust, 'nightly')
4546
run: cargo check -Z features=dev_dep
4647
- run: cargo test
4748
- run: cargo check --all --all-features --target wasm32-unknown-unknown
49+
- run: cargo hack build --all --all-features --target wasm32-unknown-unknown --no-dev-deps
4850

4951
msrv:
5052
runs-on: ubuntu-latest

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ fastrand = "2.0.0"
2222
futures-lite = { version = "2.0.0", default-features = false }
2323
slab = "0.4.4"
2424

25+
[target.'cfg(target_family = "wasm")'.dependencies]
26+
futures-lite = { version = "2.0.0", default-features = false, features = ["std"] }
27+
2528
[dev-dependencies]
2629
async-channel = "2.0.0"
2730
async-io = "2.1.0"

0 commit comments

Comments
 (0)