chore: declare rust-version = 1.87 MSRV and add deny(unsafe_code) lint gate - #346
chore: declare rust-version = 1.87 MSRV and add deny(unsafe_code) lint gate#346e-desouza wants to merge 1 commit into
Conversation
…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)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #346 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 252 252
Lines 32630 32630
=======================================
Hits 28296 28296
Misses 4334 4334
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 thexrpl-rust-macrosproc-macro crate. - Adds
unsafe_code = "forbid"under[lints.rust]inCargo.toml. - Adds
#![forbid(unsafe_code)]at the crate root insrc/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.
|
This PR is superseded by #352, which declares the same |
|
Closing — superseded by #352. |
Why
The crate had no declared
rust-version, making it unclear which Rust toolchain is required. The effective minimum is 1.87 (driven byusize::is_multiple_of, stable in 1.87, used in multiple files;edition = "2024"inxrpl-rust-macrosrequires ≥ 1.85).Without a
deny(unsafe_code)lint, there is no CI barrier against future introduction ofunsafeblocks into a crate that currently contains none.What changed
Cargo.tomlandxrpl-rust-macros/Cargo.toml: addedrust-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