Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo hack ignores my MSRV compatible Cargo.lock, preventing me from testing my MSRV #234

Open
epage opened this issue Feb 15, 2024 · 4 comments

Comments

@epage
Copy link
Contributor

epage commented Feb 15, 2024

UPDATE(taiki-e):


While I got cargo-hack working in Cargo, it seems Cargo's dependencies align on MSRV. I tried adopting it in a project where MSRVs is misaligned with dependencies and was surprised that my curated `Cargo.lock was blown away to solve #105.

@epage
Copy link
Contributor Author

epage commented Feb 15, 2024

Looking for what an agreeable solution is.

Personally, I'd prefer this behavior to be either

  • Opt-in with a --generate-lockfile flag
  • Auto-detected on if a Cargo.lock was already present (since the concern was with the cargo metadata call)

But looking for what is an acceptable solution that I can go implement so I can use this.

@taiki-e
Copy link
Owner

taiki-e commented Feb 17, 2024

Cargo itself can be free to modify the lockfiles as long as no --locked or similar is passed, right?
If so, I think we could just skip the use of generate-lockfile when those flags are passed so that we can get closer to that behavior.

epage added a commit to epage/cargo-hack that referenced this issue Feb 19, 2024
When using `--rust-version`, the lockfile can be blown away.
While that is a problem in of its own,
this focuses on an incremental step of not blowing it away if `--locked`
is used.

This is part of taiki-e#234
epage added a commit to epage/cargo-hack that referenced this issue Feb 20, 2024
When using `--rust-version`, the lockfile can be blown away.
While that is a problem in of its own,
this focuses on an incremental step of not blowing it away if `--locked`
is used.

This is part of taiki-e#234
epage added a commit to epage/cargo-hack that referenced this issue Feb 20, 2024
When using `--rust-version`, the lockfile can be blown away.
While that is a problem in of its own,
this focuses on an incremental step of not blowing it away if `--locked`
is used.

This is part of taiki-e#234
epage added a commit to epage/cargo-hack that referenced this issue Feb 20, 2024
When using `--rust-version`, the lockfile can be blown away.
While that is a problem in of its own,
this focuses on an incremental step of not blowing it away if `--locked`
is used.

This is part of taiki-e#234
taiki-e pushed a commit that referenced this issue Feb 21, 2024
When using `--rust-version`, the lockfile can be blown away.
While that is a problem in of its own,
this focuses on an incremental step of not blowing it away if `--locked`
is used.

This is part of #234
epage added a commit to epage/cargo that referenced this issue Mar 3, 2024
As a hack in cargo-hack, it doesn't respect lockfiles when doing MSRV
testing unless `--locked` is passed in.
This adds that so we make sure we don't run into problems with newer,
MSRV-imcompatible dependencies come out that break our build.

See
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/gix-ref.20CI.20error/near/423319798
- taiki-e/cargo-hack#234
- taiki-e/cargo-hack#236
@taiki-e
Copy link
Owner

taiki-e commented Mar 3, 2024

I think what I mentioned at the end of rust-lang/cargo#13523 (comment) is the only way we can do well here without additional flags or breaking changes.

bors added a commit to rust-lang/cargo that referenced this issue Mar 3, 2024
chore(ci): Ensure lockfile is respected during MSRV testing

As a hack in cargo-hack, it doesn't respect lockfiles when doing MSRV testing unless `--locked` is passed in.
This adds that so we make sure we don't run into problems with newer, MSRV-imcompatible dependencies come out that break our build.

See
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/gix-ref.20CI.20error/near/423319798
- taiki-e/cargo-hack#234
- taiki-e/cargo-hack#236
@taiki-e
Copy link
Owner

taiki-e commented Mar 31, 2024

Considering cargo's behavior around weak dependencies and namespace features (eupn/macrotest#108 (comment)), I feel it would work well to call generate-lockfile only if the MSRV is pre-1.60.

I think it was around 1.47 or 1.37 that there was a problem with the new lockfile being a completely incompatible format, and there was a compatibility issue before and after 1.51, but the above logic covers those too.

Of course, if future cargo introduces compatibility issues, the number of versions requiring generate-lockfile will probably increase.

charmitro pushed a commit to charmitro/cargo that referenced this issue Sep 13, 2024
As a hack in cargo-hack, it doesn't respect lockfiles when doing MSRV
testing unless `--locked` is passed in.
This adds that so we make sure we don't run into problems with newer,
MSRV-imcompatible dependencies come out that break our build.

See
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/gix-ref.20CI.20error/near/423319798
- taiki-e/cargo-hack#234
- taiki-e/cargo-hack#236
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

No branches or pull requests

2 participants