Skip to content

Commit

Permalink
Disable OsStrExt ettc. on WASIp2 on stable Rust. (#1301)
Browse files Browse the repository at this point in the history
`OsStrExt` and friends aren't stable on the wasm32-wasip2 target yet, so
disable features that depend on them when they aren't available.

Fixes #1060.
  • Loading branch information
sunfishcode authored Jan 30, 2025
1 parent 44a24c3 commit 9abd5fa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 48 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
run: >
rustup target add
wasm32-wasip1
wasm32-wasip2
x86_64-unknown-fuchsia
- if: matrix.rust == '1.63'
run: rustup target add x86_64-fuchsia
Expand All @@ -102,6 +103,8 @@ jobs:
- run: cargo check --workspace --release -vv --target=x86_64-unknown-netbsd --features=all-apis --all-targets
- if: matrix.rust != '1.63'
run: cargo check --workspace --release -vv --target=wasm32-wasip1 --features=all-apis
- if: matrix.rust != '1.63'
run: cargo check --workspace --release -vv --target=wasm32-wasip2 --features=all-apis
- if: matrix.rust != '1.63'
run: cargo check --workspace --release -vv --target=x86_64-unknown-fuchsia --features=all-apis --all-targets
- if: matrix.rust == '1.63'
Expand Down Expand Up @@ -179,10 +182,8 @@ jobs:
- run: >
rustup target add
x86_64-unknown-redox
wasm32-wasip1
thumbv7neon-unknown-linux-gnueabihf
- run: cargo check --workspace --release -vv --target=x86_64-unknown-redox --features=all-apis
- run: cargo check --workspace --release -vv --target=wasm32-wasip1 --features=all-apis
- run: cargo check --workspace --release -vv --target=thumbv7neon-unknown-linux-gnueabihf --features=all-apis

check_tier3:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,6 @@ check-cfg = [
'cfg(thumb_mode)',
'cfg(wasi)',
'cfg(wasi_ext)',
'cfg(wasip2)',
'cfg(target_arch, values("xtensa"))',
]
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn main() {
// WASI support can utilize wasi_ext if present.
if os == "wasi" {
use_feature_or_nothing("wasi_ext");
use_feature_or_nothing("wasip2");
}

// If the libc backend is requested, or if we're not on a platform for
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
all(
target_os = "wasi",
target_env = "p2",
any(feature = "fs", feature = "mount", feature = "net")
any(feature = "fs", feature = "mount", feature = "net"),
wasip2,
),
feature(wasip2)
)]
Expand Down
Loading

0 comments on commit 9abd5fa

Please sign in to comment.