Skip to content

Identify/decide minimum supported version of Rust #1276

Closed

Description

@DanielEScherzer

C.f. #1238

If I understand correctly:

edition = "2021"
means that MSRV >= 1.56.0

bitflags = "2.1.0"
means MSRV >= 1.56.0 (https://docs.rs/crate/bitflags/2.1.0/source/Cargo.toml#55)

git2-rs/Cargo.lock

Lines 474 to 476 in 7415113

[[package]]
name = "libc"
version = "0.2.174"
means MSRV >= 1.63.0 (https://docs.rs/crate/libc/0.2.174/source/Cargo.toml#52)

|| cfg!(windows) && path.chars().nth(1).is_some_and(|x| x == ':')
means MSRV >= 1.70.0 (https://blog.rust-lang.org/2023/06/01/Rust-1.70.0/) (unless we want to say that there is a different MSRV depending on which features are enabled?)

assert!(get_cached_memory().is_ok_and(|m| m.1 == 20 * 1024 * 1024));
means tests are MSRV >= 1.70.0 for the same reason

Activity

  1. DanielEScherzer commented on Jun 11, 2026

    @DanielEScherzer
    ContributorAuthor

    If we go with 1.81+ we can use #[expect] with a lint reason, so I would prefer that in order to work towards adding clippy, but regardless of what version we use, we should probably add it to CI to ensure that we don't accidentally lose support

  2. weihanglo commented on Jun 11, 2026

    @weihanglo
    Member

    Thanks for the analysis! Maybe we can run https://crates.io/crates/cargo-msrv and figure out?

  3. DanielEScherzer commented on Jun 11, 2026

    @DanielEScherzer
    ContributorAuthor
    root@406fa489d8c6:/rust/git2-rs# cargo install cargo-msrv --locked
    ...
    root@406fa489d8c6:/rust/git2-rs# cargo msrv find
      [Meta]   cargo-msrv 0.19.3  
    
    Compatibility Check #1: Rust 1.76.0
      [FAIL]   Is incompatible 
                                                                                                                                             
      ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
      │ error: failed to parse lock file at: /rust/git2-rs/Cargo.lock                                                                       │
      │                                                                                                                                     │
      │ Caused by:                                                                                                                          │
      │   lock file version `4` was found, but this version of Cargo does not understand this lock file, perhaps Cargo needs to be updated? │
      │                                                                                                                                     │
      ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                                                             
    
    Compatibility Check #2: Rust 1.86.0
      [FAIL]   Is incompatible 
                                                                                                              
      ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮
      │    Compiling libc v0.2.174                                                                           │
      │    Compiling shlex v1.3.0                                                                            │
      │    Compiling pkg-config v0.3.32                                                                      │
      │    Compiling vcpkg v0.2.15                                                                           │
      │     Checking bitflags v2.9.1                                                                         │
      │     Checking log v0.4.27                                                                             │
      │    Compiling jobserver v0.1.33                                                                       │
      │    Compiling cc v1.2.27                                                                              │
      │    Compiling libz-sys v1.1.22                                                                        │
      │    Compiling libgit2-sys v0.18.5+1.9.4 (/rust/git2-rs/libgit2-sys)                                   │
      │ warning: libgit2-sys@0.18.5+1.9.4: failed to probe system libgit2:                                   │
      │     Checking git2 v0.21.0 (/rust/git2-rs)                                                            │
      │ error[E0658]: use of unstable library feature `inherent_str_constructors`                            │
      │    --> src/blame.rs:207:25                                                                           │
      │     |                                                                                                │
      │ 207 |             Some(sb) => str::from_utf8(sb).map(|s| Some(s)).map_err(|e| e.into()),             │
      │     |                         ^^^^^^^^^^^^^^                                                         │
      │     |                                                                                                │
      │     = note: see issue #131114 <https://github.com/rust-lang/rust/issues/131114> for more information │
      │                                                                                                      │
      │ For more information about this error, try `rustc --explain E0658`.                                  │
      │ error: could not compile `git2` (lib) due to 1 previous error                                        │
      │                                                                                                      │
      ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                              
    
    Compatibility Check #3: Rust 1.91.1
      [OK]     Is compatible 
    
    Compatibility Check #4: Rust 1.88.0
      [OK]     Is compatible 
    
    Compatibility Check #5: Rust 1.87.0
      [OK]     Is compatible 
    
    Result:
       Considered (min … max):   Rust 1.56.1 … Rust 1.96.0 
       Search method:            bisect                    
       MSRV:                     1.87.0                    
       Target:                   x86_64-unknown-linux-gnu  
                                                          
    
  4. added 3 commits that reference this issue on Jun 11, 2026
    18f94f8
    52ba070
    9594c74
  5. weihanglo commented on Jun 11, 2026

    @weihanglo
    Member

    Thanks for that. 1.87 sounds good to me. Do we want to check MSRV of our major consumers on crates.io / GitHub, and see if it may piss people off?

  6. added a commit that references this issue on Jun 11, 2026
    1485647
  7. weihanglo commented on Jun 11, 2026

    @weihanglo
    Member

    Also, I guess we probably need to set for also libgit2-sys?

  8. added 2 commits that reference this issue on Jun 11, 2026
    842ffb1
    34faa43
  9. DanielEScherzer commented on Jun 11, 2026

    @DanielEScherzer
    ContributorAuthor

    Thanks for that. 1.87 sounds good to me. Do we want to check MSRV of our major consumers on crates.io / GitHub, and see if it may piss people off?

    Given that this doesn't compile with 1.86 I think major consumers would have already complained if they were trying to use older Rust

    Checked all crates with over a million downloads (there are 1832 reverse dependencies, not going to check them all)

  10. weihanglo commented on Jun 13, 2026

    @weihanglo
    Member

    I guess libgit2-sys can be a bit lower? That sys crate can be as low as 1.63.0 (pre sparse registry), thought I don't know if it is particularly useful.

    We might also want to use the new ctest which requires 1.88 (#1262), though dev dependency doesn't really affect publish MSRV.

    I am fine with 1.87 for all. @ehuss any thought?

  11. ehuss commented on Jun 15, 2026

    @ehuss
    Contributor

    1.87 seems fine. I'm fine with an even newer version (like stable-3). Usually I just bump the rust version when there is some new feature I want/need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions