Skip to content

Commit a23f396

Browse files
cdmurph32Stebalien
andauthored
fix: enable wasip2 feature for wasm32-wasip2 target (#305)
- wasip2 will require +nightly until rust-lang/rust#130323 is resolved and/or std::os::wasip2 is available in stable. - Support was added to rustix for version 0.38.39 bytecodealliance/rustix#1205 Signed-off-by: Colin Murphy <[email protected]> Co-authored-by: Steven Allen <[email protected]>
1 parent f162807 commit a23f396

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/ci.yml

+12
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ jobs:
5757
targets: wasm32-wasip1
5858
- name: Build
5959
run: cargo build --target wasm32-wasip1 --features nightly
60+
wasip2:
61+
name: WASI P2 Test Build
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
- name: Install Rust
67+
uses: dtolnay/rust-toolchain@nightly
68+
with:
69+
targets: wasm32-wasip2
70+
- name: Build
71+
run: cargo build --target wasm32-wasip2 --features nightly
6072
wasm:
6173
name: WASM Test Build
6274
runs-on: ubuntu-latest

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fastrand = "2.1.1"
2323
once_cell = { version = "1.19.0", default-features = false, features = ["std"] }
2424

2525
[target.'cfg(any(unix, target_os = "wasi"))'.dependencies]
26-
rustix = { version = "0.38.37", features = ["fs"] }
26+
rustix = { version = "0.38.39", features = ["fs"] }
2727

2828
[target.'cfg(windows)'.dependencies.windows-sys]
2929
version = ">=0.52,<=0.59"

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@
136136
#![cfg_attr(test, deny(warnings))]
137137
#![deny(rust_2018_idioms)]
138138
#![allow(clippy::redundant_field_names)]
139+
// wasip2 conditionally gates stdlib APIs.
140+
// https://github.com/rust-lang/rust/issues/130323
141+
#![cfg_attr(
142+
all(feature = "nightly", target_os = "wasi", target_env = "p2"),
143+
feature(wasip2)
144+
)]
139145
#![cfg_attr(all(feature = "nightly", target_os = "wasi"), feature(wasi_ext))]
140146

141147
#[cfg(doctest)]

0 commit comments

Comments
 (0)