Skip to content

fix: reduce MSRV to 1.70 and add CI#4

Merged
EricLBuehler merged 6 commits into
EricLBuehler:masterfrom
LDeakin:msrv_1.70
Aug 9, 2025
Merged

fix: reduce MSRV to 1.70 and add CI#4
EricLBuehler merged 6 commits into
EricLBuehler:masterfrom
LDeakin:msrv_1.70

Conversation

@LDeakin

@LDeakin LDeakin commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

Nice crate!

33c1797 (0.2.1) raised the MSRV to 1.83. This reduces it back to 1.70 (hopefully), sets an MSRV, and adds CI for it.

Summary by CodeRabbit

  • Chores

    • Updated continuous integration to test with Rust 1.70 in addition to the stable version.
    • Specified Rust 1.70 as the minimum required compiler version for the project.
  • Bug Fixes

    • Improved compatibility with Rust 1.70 for floating-point conversions.

@coderabbitai

coderabbitai Bot commented Jun 18, 2025

Copy link
Copy Markdown

Walkthrough

The updates introduce Rust 1.70 as the minimum supported version in the project manifest and ensure CI checks run on both stable and 1.70 toolchains. Internally, a floating-point to bit conversion now uses std::mem::transmute for compatibility, with a note to revert when a newer Rust version is adopted.

Changes

File(s) Change Summary
.github/workflows/ci.yml Expanded CI matrix to test on both stable and Rust 1.70 toolchains across all supported OSes.
Cargo.toml Added rust-version = "1.70" to specify the minimum supported Rust compiler version.
src/lib.rs Replaced f64::to_bits() with std::mem::transmute for bit conversion; added comment for future reversion.

Poem

Rusty rabbits hop with glee,
Supporting 1.70, as you can see!
CI multiplies, checks abound,
Bit tricks safely hop around.
With every byte and every hop,
Our code keeps running, never to stop!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (1)
src/lib.rs (1)

113-115: Document unsafe transmute and tighten its scope

Using std::mem::transmute inside a const fn is a pragmatic workaround because f64::to_bits isn’t const in Rust 1.70.
However, every unsafe block should state why it is sound to avoid accidental misuse later.

-    // TODO: use x.to_bits() with MSRV 1.83
-    let xbits: u64 = unsafe { std::mem::transmute::<f64, u64>(x) };
+    // SAFETY: `f64` and `u64` have identical size and alignment; the bit-pattern
+    // copy preserves the exact IEEE-754 representation.  This is equivalent to
+    // `f64::to_bits()` which is not `const` on Rust 1.70.  Replace with
+    // `x.to_bits()` once the MSRV ≥ 1.83.
+    let xbits: u64 = unsafe { std::mem::transmute(x) };

(Using the turbofish is redundant when the types are evident.)

Consider gating this behind a helper const fn to_bits_const so the unsafe block is written once and removed easily when the MSRV is raised.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33c1797 and 6dbb810.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .github/workflows/ci.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • src/lib.rs (1 hunks)
🔇 Additional comments (2)
Cargo.toml (1)

4-4: MSRV field correctly added

Explicitly pinning rust-version = "1.70" is the right way to make Cargo enforce the lowered MSRV at build time.
No further action needed.

.github/workflows/ci.yml (1)

21-21: Add Rust 1.70 to the test matrix as well

Only the “check” job compiles on 1.70; the “test” job still runs on stable only. This means logic errors that slip past cargo check (e.g. failed assertions, panics, feature-gated behaviour) are not exercised on the MSRV toolchain.

-        rust: [stable]
+        rust: [stable, 1.70]

Mirroring the same matrix you defined for the “check” job keeps compilation and execution coverage in sync.

Likely an incorrect or invalid review comment.

@EricLBuehler

Copy link
Copy Markdown
Owner

Hi @LDeakin, thanks for the PR! If you could please fix the merge errors I'd be happy to merge.

@LDeakin

LDeakin commented Aug 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @EricLBuehler, hopefully all is fixed on the CI side now

@EricLBuehler EricLBuehler merged commit deb5797 into EricLBuehler:master Aug 9, 2025
14 checks passed
@EricLBuehler

Copy link
Copy Markdown
Owner

Thank you!

@LDeakin

LDeakin commented Aug 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @EricLBuehler! Rust 1.70 is quite old, but once you have a release out with rust-version = "1.70", then Cargo's new MSRV resolver can kick in and there will be minimal breakage if you wish to upgrade your MSRV.

@LDeakin LDeakin deleted the msrv_1.70 branch August 9, 2025 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants