Update MSRV to Rust 1.82 and replace once_cell with std equivalents #2217
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.
This PR updates the Minimum Supported Rust Version (MSRV) to 1.82 and replaces most usages of the
once_cell
crate with standard library equivalents that are now available in stable Rust.Changes
MSRV Update
Updated
rust-version
from various versions (1.70, 1.74) to1.82
in 78 Cargo.toml files across the repository.once_cell Replacements
Replaced all 26 instances of
once_cell::sync::Lazy
withstd::sync::LazyLock
(stable since Rust 1.80):gix-tempfile/src/{lib.rs, signal.rs}
tests/tools/src/lib.rs
gix-path/src/env/{mod.rs, git/mod.rs, auxiliary.rs}
gix/src/interrupt.rs
src/shared.rs
tests/it/src/commands/check_mode.rs
Why OnceCell Remains
The
OnceCell
type ingix-features/src/threading.rs
continues to useonce_cell
becausestd::sync::OnceLock::get_or_try_init()
is not yet stable in Rust (tracking issue: rust-lang/rust#109737). This method is essential for error handling during lazy initialization in multiple places throughout the codebase, particularly ingix/src/config/cache/access.rs
.Once
get_or_try_init()
is stabilized, we can complete the migration by updating theOnceCell
type aliases to usestd::sync::OnceLock
andstd::cell::OnceCell
.Dependency Cleanup
Removed the
once_cell
dependency from 12 Cargo.toml files where it's no longer needed. The dependency is retained only ingix-features
(with theonce_cell
feature flag) to support theOnceCell
type until the standard library API is fully stabilized.Testing
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.