From 7567f14ba5e1f94dcc4c305ae0f51e1519aa2b92 Mon Sep 17 00:00:00 2001 From: Martijn Gribnau Date: Wed, 6 Oct 2021 03:00:44 +0200 Subject: [PATCH] Do not ignore the lockfile during a CI run 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 https://github.com/rust-lang/rust/issues/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. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42398c70..f3083c72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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