Fix wasm32-unknown-unknown target build by moreal · Pull Request #6278 · RustPython/RustPython
Walkthrough
Workspace chrono dependency changed from a simple version to an explicit table (version, disabled default features, enabled features). crates/vm removed chrono's wasmbind feature and deleted a wasm32-specific getrandom dependency block. Added #[unsafe(no_mangle)] to the exported eval function in the wasm test crate.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Workspace Cargo Cargo.toml |
chrono changed from chrono = "0.4.42" to chrono = { version = "0.4.42", default-features = false, features = ["clock", "oldtime", "std"] } under [workspace.dependencies]. |
VM crate Cargo crates/vm/Cargo.toml |
chrono dependency changed from { workspace = true, features = ["wasmbind"] } to { workspace = true }. Removed getrandom = { workspace = true } from the wasm32 target-specific dependencies. |
WASM test export wasm/wasm-unknown-test/src/lib.rs |
Annotated the public exported function pub unsafe extern "C" fn eval(s: *const u8, l: usize) -> u32 with #[unsafe(no_mangle)]. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Verify that the selected chrono features (
clock,oldtime,std) anddefault-features = falsesatisfy all crate consumers. - Confirm removing
wasmbindfrom the VM crate doesn't break any wasm-specific APIs or build flags. - Inspect removal of the wasm32
getrandomentry to ensure randomness support for wasm targets remains provided elsewhere. - Check that
#[unsafe(no_mangle)]is the intended attribute and compatible with the wasm toolchain and downstream bindings.
Possibly related PRs
- wasm_js rustlfags on top workspace #6116 — touches wasm-related Cargo configuration and wasm/getrandom/wasmbind handling; likely related to the workspace/wasm dependency adjustments.
Suggested reviewers
- youknowone
Poem
🐰
I nibbled through Cargo lines at dawn,
swapped a version for features, tidy and drawn.
I pruned a wasm flag, let getrandom rest,
pinned eval's export for safety's best.
Hoppity-hop — the build hops on its quest. 🥕
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Fix wasm32-unknown-unknown target build' directly and accurately summarizes the main objective of the pull request, which focuses on fixing builds for the wasm32-unknown-unknown target. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
📜 Recent review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/vm/Cargo.toml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/vm/Cargo.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Check Rust code with clippy
- GitHub Check: Ensure compilation on various targets
- GitHub Check: auto_format
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.
Comment @coderabbitai help to get the list of available commands and usage tips.