Commit ec99fe5
committed
fix: enable wasip2 feature for wasm32-wasip2 target
After PR chipsenkbeil#51 added the requirement `any(windows, unix)` to expose native
and platform modules, and Rust changed WASI targets to set the `unix` cfg
(rust-lang/rust#147572), typed-path now attempts to compile code using
`std::os::wasi` for WASI targets. However, this is an unstable feature
requiring `#![feature(wasip2)]` when targeting wasm32-wasip2.
This commit adds the wasip2 feature flag conditionally only for wasip2
targets (target_env = "p2"), allowing the crate to compile with nightly
Rust for wasm32-wasip2 while maintaining compatibility with wasm32-wasip1
which does not have or need this feature.
Also fixes an unused import warning for `std::io` on wasm targets where
the `absolutize` function (which uses `io`) is not available.
Tested on both wasm32-wasip1 and wasm32-wasip2 targets - all 160 tests
pass on both platforms.1 parent 8f6f9e7 commit ec99fe5
2 files changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
0 commit comments