matklad / once_cell

Rust library for single assignment cells and lazy statics without macros
Apache License 2.0
1.84k stars 110 forks source link

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

Closed decathorpe closed 1 year ago

decathorpe commented 1 year ago

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.

matklad commented 1 year ago

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.

decathorpe commented 1 year ago

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!

matklad commented 1 year ago

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:

https://github.com/matklad/once_cell/blob/ba8b9fe98b1a61bfda3ef512b582180fe230f292/xtask/src/main.rs#L47-L52