Skip to content

chore: declare rust-version = 1.87 MSRV and add deny(unsafe_code) lint gate - #346

Closed
e-desouza wants to merge 1 commit into
mainfrom
fix/cargo-hygiene
Closed

chore: declare rust-version = 1.87 MSRV and add deny(unsafe_code) lint gate#346
e-desouza wants to merge 1 commit into
mainfrom
fix/cargo-hygiene

Conversation

@e-desouza

Copy link
Copy Markdown
Collaborator

Why

The crate had no declared rust-version, making it unclear which Rust toolchain is required. The effective minimum is 1.87 (driven by usize::is_multiple_of, stable in 1.87, used in multiple files; edition = "2024" in xrpl-rust-macros requires ≥ 1.85).

Without a deny(unsafe_code) lint, there is no CI barrier against future introduction of unsafe blocks into a crate that currently contains none.

What changed

  • Cargo.toml and xrpl-rust-macros/Cargo.toml: added rust-version = "1.87" to [package].
  • Cargo.toml: added [lints.rust] unsafe_code = "forbid".
  • src/lib.rs: added #![forbid(unsafe_code)] as first crate attribute.

How to validate

cargo build --release
cargo clippy --all-features -- -D warnings

…7 MSRV

- Add `[lints.rust] unsafe_code = "forbid"` to Cargo.toml to block any
  future use of unsafe blocks at compile time
- Add `#![forbid(unsafe_code)]` crate-level attribute to src/lib.rs
- Declare `rust-version = "1.87"` in both Cargo.toml and
  xrpl-rust-macros/Cargo.toml; 1.87 is the actual floor driven by
  `is_multiple_of` (stable 1.87), `is_none_or` (stable 1.82), and the
  2024 edition in xrpl-rust-macros (requires 1.85)
@e-desouza
e-desouza requested a review from Copilot July 12, 2026 18:22
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.71%. Comparing base (c83df4f) to head (603fde9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #346   +/-   ##
=======================================
  Coverage   86.71%   86.71%           
=======================================
  Files         252      252           
  Lines       32630    32630           
=======================================
  Hits        28296    28296           
  Misses       4334     4334           
Flag Coverage Δ
integration 71.32% <ø> (ø)
unit 87.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/lib.rs 0.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

Pull request overview

This PR formalizes the repository’s minimum supported Rust version (MSRV) and adds a guardrail to prevent future introduction of unsafe code.

Changes:

  • Declares rust-version = "1.87" for both the main crate and the xrpl-rust-macros proc-macro crate.
  • Adds unsafe_code = "forbid" under [lints.rust] in Cargo.toml.
  • Adds #![forbid(unsafe_code)] at the crate root in src/lib.rs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Cargo.toml Declares MSRV 1.87 and forbids unsafe_code via Cargo lint configuration.
src/lib.rs Enforces #![forbid(unsafe_code)] at the crate root.
xrpl-rust-macros/Cargo.toml Declares MSRV 1.87 for the proc-macro crate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@e-desouza

Copy link
Copy Markdown
Collaborator Author

This PR is superseded by #352, which declares the same rust-version = "1.87" MSRV and [lints.rust] unsafe_code = "forbid" in both Cargo.toml and xrpl-rust-macros/Cargo.toml. Closing in favor of that PR.

@e-desouza

Copy link
Copy Markdown
Collaborator Author

Closing — superseded by #352.

@e-desouza e-desouza closed this Jul 14, 2026
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