-
Notifications
You must be signed in to change notification settings - Fork 1.3k
wasm_js rustlfags on top workspace #6116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds wasm32-unknown-unknown rustflags in top-level Cargo config, introduces a wasm32 (non-WASI) target-specific dependency on getrandom with the wasm_js feature in common/Cargo.toml, and removes the redundant wasm32 rustflags from wasm/lib’s local Cargo config. Build target for wasm/lib remains wasm32-unknown-unknown. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.cargo/config.toml (1)
7-8
: Workspace-level wasm_js cfg looks good; minor quoting/style nit and scope checkMoving the cfg to the top-level target is the right direction. Two nits:
- Use single-quoted TOML to avoid inner escapes.
- Confirm this broad workspace-level cfg is intended for all crates when building for wasm32-unknown-unknown (it will apply to all members and their deps for that target).
Apply within this hunk:
-[target.wasm32-unknown-unknown] -rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] +[target.wasm32-unknown-unknown] +rustflags = ['--cfg=getrandom_backend="wasm_js"']common/Cargo.toml (1)
39-41
: Double-check getrandom feature name; likely unnecessary/incorrect herePlease verify that getrandom provides a feature literally named "wasm_js". If not, this will fail or be a no-op; the backend selection is already driven by the cfg you added via rustflags. If the cfg is sufficient (it usually is), drop the feature and possibly the whole target-specific dep block to avoid confusion/duplication with the global getrandom dep on Line 22.
Option A — keep the block but remove the feature:
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] -getrandom = { workspace = true, features = ["wasm_js"] } +getrandom = { workspace = true }Option B — remove the redundant block entirely (global dep already exists):
-[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] -getrandom = { workspace = true, features = ["wasm_js"] }Also, if the workspace isn’t on Cargo feature resolver = "2", consider enabling it at the workspace root to prevent unintended feature unification across targets.
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
.cargo/config.toml
(1 hunks)common/Cargo.toml
(1 hunks)wasm/lib/.cargo/config.toml
(0 hunks)
💤 Files with no reviewable changes (1)
- wasm/lib/.cargo/config.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). (11)
- GitHub Check: Run tests under miri
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Check Rust code with rustfmt and clippy
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Ensure compilation on various targets
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
Ah, actually - that test failure is why the config is the way it is. Putting it in the top level means js gets selected even when we're not compiling wasm for browser. |
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] | ||
getrandom = { workspace = true, features = ["wasm_js"] } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] | |
getrandom = { workspace = true, features = ["wasm_js"] } |
This is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, true. I guess that should be enabled by a js
feature flag that common exposes.
Summary by CodeRabbit
Bug Fixes
Chores