fix: move cdylib to separate float-wasm crate#172
Closed
Conversation
The `cdylib` crate-type on `rain-math-float` causes Cargo to produce
output artifacts with colliding filenames (rlib and cdylib both generate
`librain_math_float.*`). On Linux, this results in `alloy_primitives`
being compiled as two separate crate instances, causing type mismatches
for any downstream crate that imports both `alloy_primitives` and
`rain_math_float`:
expected `FixedBytes<32>`, found a different `FixedBytes<32>`
note: two different versions of crate `alloy_primitives` are being used
See: rust-lang/cargo#6313
The fix moves `cdylib` to a dedicated `rain-math-float-wasm` wrapper
crate (`crates/float-wasm`), keeping the core library as `rlib`-only.
WASM consumers should depend on `rain-math-float-wasm` instead. Native
consumers are unaffected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughA new WASM wrapper crate (rain-math-float-wasm) is introduced with separate crate manifest and module exports. The existing float crate's crate-type is modified from ["rlib", "cdylib"] to ["rlib"], delegating CDYLIB compilation to the new wrapper crate. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
cdylibfromcrate-typeincrates/float/Cargo.toml, keeping onlyrlibfloat-wasmcrate (crates/float-wasm/) as the WASM build targetProblem
Having
crate-type = ["rlib", "cdylib"]causes Cargo to compilealloy_primitivesas two separate crate instances, causing type mismatches for downstream crates:See: rust-lang/cargo#6313
Fix
The
cdylibtarget is moved to a separatefloat-wasmwrapper crate (crates/float-wasm/).Summary by CodeRabbit
New Features
Chores