Skip to content

Commit

Permalink
Do not ignore the lockfile during a CI run
Browse files Browse the repository at this point in the history
By ignoring the lockfile, it will be regenerated for each run. The idea behind it is that we can have some compatibility for different lock file versions. However, even with a lockfile, a dependency version may be updated to a (hopefully semver compatible) version which falls within the semver requirements. If some dependency then introduces a change which breaks our MSRV, while Cargo pulls in a specified, newer, matching semantic version, we may still fail.

As an example: if we have an dependency A, with published versions 0.1 and 0.2, and our in-repo lockfile takes 0.1 while a newly generated lockfile may take 0.2 instead, and 0.2 has a higher MSRV than 0.1, then by removing the lockfile we our MSRV changes, which is a problem for MSRV verification.

In this specific case, on Rust toolchain versions below 1.46 (our MSRV is 1.42), we get the following error:

```
error[E0658]: `while` is not allowed in a `const fn`
  --> /user/.cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.5/src/header/value.rs:85:9
   |
85 | /         while i < bytes.len() {
86 | |             if !is_visible_ascii(bytes[i]) {
87 | |                 ([] as [u8; 0])[0]; // Invalid header value
88 | |             }
89 | |             i += 1;
90 | |         }
   | |_________^
   |
   = note: for more information, see rust-lang/rust#52000

```

For the `--ignore-lockfile` option itself, we'll need to figure out a strategy where we can convert between lockfile version, while keeping the versions in the Cargo.lock file the same. While in an ideal world, this error could have been prevented proper semver specifications, in the real world, such issues happen, and cargo-msrv should not overly rely on down-tree dependency specifications.
  • Loading branch information
foresterre committed Oct 6, 2021
1 parent c219fdb commit 7567f14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ jobs:
- name: version_of_cargo_msrv
run: cargo msrv --version # as of writing: 0.7.0 (required for --verify)
- name: run_cargo_msrv
run: cargo msrv --verify --ignore-lockfile --output-format json | jsonlines-tail | jq --exit-status .success
run: cargo msrv --verify --output-format json | jsonlines-tail | jq --exit-status .success

0 comments on commit 7567f14

Please sign in to comment.