GeezerVison is showing github.com — Fix wasip2 build by youknowone · Pull Request #6935 · RustPython/RustPython
Conversation
youknowone
commented
Feb 1, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fix #6891
Fix #5704
Summary by CodeRabbit
- Chores
- Updated CI workflow to include compilation verification for the wasm32-wasip2 target.
- Removed conditional feature gating from crate-level attributes.
- Refactored platform-specific FFI implementations and path handling for WASI environments.
- Updated standard library module exports for WASI platform compatibility.
✏️ Tip: You can customize this high-level summary in your review settings.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Feb 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 Walkthrough
Walkthrough
The pull request migrates RustPython away from the unstable wasip2 feature flag by providing custom stable implementations of wasip2-specific APIs. It removes feature gates, adds a new WASI p2-specific ffi module with OsStrExt and OsStringExt traits, updates API imports and usage, and extends CI to verify compilation for the wasm32-wasip2 target.
Changes
| Cohort / File(s) |
Summary |
Feature gate removal src/lib.rs, crates/stdlib/src/lib.rs, crates/common/src/lib.rs |
Removes crate-level #![cfg_attr(...wasip2)] and #![feature(wasip2)] attributes, eliminating reliance on the unstable wasip2 feature flag. |
WASI p2 stable ffi implementation crates/common/src/os.rs |
Introduces a new pub mod ffi under cfg(all(target_os = "wasi", target_env = "p2")) with custom trait definitions: OsStrExt (as_bytes, from_bytes) and OsStringExt (from_vec, into_vec). Includes trait implementations for std::ffi types and a sealed module, leveraging UTF-8 guarantees for WASI p2 compatibility. |
API import and usage updates crates/stdlib/src/select.rs, src/settings.rs |
Updates RawFd re-export path from std::os::wasi::io::RawFd to std::os::fd::RawFd. Changes split_paths implementation to use as_encoded_bytes() and from_encoded_bytes_unchecked() instead of unstable OsStrExt trait methods. |
CI enhancement .github/workflows/ci.yaml |
Adds rust-toolchain installation and cargo check step for the wasm32-wasip2 target to verify compilation on WASI p2 builds. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- PR
#5985: Converts string-based APIs to byte-oriented operations (as_bytes, as_encoded_bytes), employing similar patterns for handling encoded bytes across the codebase.
Poem
🐰 No longer trapped by unstable gates so tight,
WASI p2 shines with implementations bright,
Custom traits bloom, where bytes dance free,
Stable foundations for all to see! ✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title "Fix wasip2 build" directly corresponds to the main objective of addressing wasm32-wasip2 compilation failures referenced in issues #6891 and #5704. |
| Linked Issues check |
✅ Passed |
The PR addresses both linked issues by providing stable WASI p2 FFI implementations, adjusting platform imports, removing conditional wasip2 features, and updating the split_paths implementation to work with wasip2 without relying on unstable features. |
| Out of Scope Changes check |
✅ Passed |
All changes are directly scoped to fixing wasip2 target compilation: CI workflow updates, WASI p2 FFI module implementations, feature flag removal, and import path adjustments align with the stated objectives. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Code has been automatically formatted
The code in this PR has been formatted using:
cargo fmt --all
Please pull the latest changes before pushing again:
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|