Fix MSRV build: qualify size_of, add cargo-msrv CI check#121
Merged
Conversation
`std::mem::size_of` was only added to the prelude in Rust 1.80, but the declared MSRV is 1.71. It was used unqualified in linked_slab.rs, breaking builds for downstream crates on Rust < 1.80. Qualify the call as `std::mem::size_of` (matching shard.rs) and add an `msrv` CI job that runs `cargo msrv verify` so this regression is caught in the future. Fixes #118
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.
Fixes #118.
Problem
std::mem::size_ofwas only added to the standard prelude in Rust 1.80, but the declared MSRV is 1.71 (rust-version = "1.71"inCargo.toml). It was used unqualified inlinked_slab.rs::memory_used, so downstream crates on Rust < 1.80 failed to build (reported on 1.75).Fix
std::mem::size_of::<Entry<T>>()(matching the existing usage inshard.rs).msrvCI job that runscargo msrv verify, which checks the crate compiles with therust-versiondeclared inCargo.toml, across the same feature combinations as the existing check job. CI previously only ran onstable, which is why this slipped through.Verification
Tested locally with
cargo-msrv0.19.3 against a real Rust 1.71.0 toolchain:cargo msrv verifyreports compatible with 1.71.0 for default features,--features stats,--no-default-features, and--no-default-features --features sharded-lock.cargo msrv verifyfail withE0425(cannot findsize_of), confirming the new CI job actually catches this class of regression.