fix: enable wasip2 feature for wasm32-wasip2 target #57
+4
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After PR #51 added the requirement
any(windows, unix)to expose native and platform modules, and Rust changed WASI targets to use moreunix.rsimplementations in the standard library (rust-lang/rust#147572), typed-path now attempts to compile code usingstd::os::wasifor 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::ioon wasm targets where theabsolutizefunction (which usesio) is not available.Successfully tested on both wasm32-wasip1 and wasm32-wasip2 targets.