matklad / once_cell

Rust library for single assignment cells and lazy statics without macros

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSRV jumps from 1.56 to 1.63 with critical_section feature or when compiling tests

decathorpe opened this issue · comments

The critical-section/std feature has an MSRV of 1.63.0 (because it relies on Mutex::new being a const fn), which is kind of a big jump from 1.56.0. Since the root cause lies on a different crate, maybe this MSRV bump is unintentional?

It doesn't affect once_cell if the critical_section feature is disabled or when not compiling the tests, so the MSRV bump in this specific circumstance might have gone unnoticed so far.

As per MSRV policy, enabling features switches to a very aggressive MSRV:

When using other features, like parking_lot, MSRV might be updated more frequently, up to the latest stable.

I am not sure anything better is possible? If a user chooses to use once_cell with critical_section, they get the least conservative MSRV of the two crates.

Yeah, fair point. I just wanted to make sure that this wasn't an unintentional change. It's not a big problem in my case, I just disabled building + running the once_cell test suite for package builds on RHEL 9 (which is stuck at Rust 1.62.0). Thanks for clarifying!

Yeah, for test suite in particular, we don't give any MSRV guarantees, as that's not a part of the public API. But for the reference here's the part that runs the MSRV-compatible subset:

{
let _s = section("TEST_MSRV");
let _e = push_toolchain(&sh, MSRV)?;
sh.copy_file("Cargo.lock.msrv", "Cargo.lock")?;
cmd!(sh, "cargo build").run()?;
}