Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 13, 2025

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) to 1.82 in 78 Cargo.toml files across the repository.

once_cell Replacements

Replaced all 26 instances of once_cell::sync::Lazy with std::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
  • Various test files throughout the repository

Why OnceCell Remains

The OnceCell type in gix-features/src/threading.rs continues to use once_cell because std::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 in gix/src/config/cache/access.rs.

Once get_or_try_init() is stabilized, we can complete the migration by updating the OnceCell type aliases to use std::sync::OnceLock and std::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 in gix-features (with the once_cell feature flag) to support the OnceCell type until the standard library API is fully stabilized.

Testing

  • ✅ Entire workspace builds successfully
  • ✅ All tests pass for modified packages
  • ✅ No regressions introduced
Original prompt

@GitoxideLabs/gitoxide/issues/2216 Update the MSRV to Rust 1.82, and then replace usages of once_cell with std::cell::OnceCell or std::sync::LazyLock where possible.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI assigned Copilot and Byron Oct 13, 2025
@Copilot Copilot AI changed the title [WIP] Update MSRV to Rust 1.82 and replace once_cell usage Update MSRV to Rust 1.82 and replace once_cell with std equivalents Oct 13, 2025
@Copilot Copilot AI requested a review from Byron October 13, 2025 07:06
Copilot finished work on behalf of Byron October 13, 2025 07:06
This couldn't happen everywhere just yet.

Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
@Byron Byron force-pushed the copilot/update-msrv-to-rust-1-82 branch from c87d09f to 0eb90d3 Compare October 15, 2025 07:24
@Byron Byron marked this pull request as ready for review October 15, 2025 07:24
@Byron Byron force-pushed the copilot/update-msrv-to-rust-1-82 branch 2 times, most recently from 240cfad to c9e7d5a Compare October 15, 2025 07:35
@Byron Byron enabled auto-merge October 15, 2025 07:42
@Byron Byron force-pushed the copilot/update-msrv-to-rust-1-82 branch from e430454 to 6819e54 Compare October 15, 2025 07:44
@Byron Byron merged commit 4da2927 into main Oct 15, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants