clap-rs / clap

A full featured, fast Command Line Argument Parser for Rust
docs.rs/clap
Apache License 2.0
13.66k stars 1.02k forks source link

chore: Update MSRV to 1.74 #5343

Closed epage closed 5 months ago

epage commented 5 months ago
digitalmoksha commented 4 months ago

@epage As I'm fairly new to Rust, I have a question about this PR. I'm running a build in CI, which needs to install wasm-pack, which has been at version 0.12.1 for a few months.

I'm using rust 1.73.0. But when my job runs, it now fails because wasm-pack is dependent on version = "0.6.0" of clap-lex. But now it's pulling in 0.7.0 (as of just a few hours ago), which requires a version of rust beyond what I'm using.

What's the best way to deal with this when I don't own wasm-pack so can't change how dependencies are specified? It seems like updating the MSRV can wreak havoc on those that use the dependency.

digitalmoksha commented 4 months ago

And it's not like I can force a version in my own Cargo.toml file. Since I need to do a cargo install wasm-pack, I have no control over what versions of dependencies get compiled for wasm-pack. 🤔

epage commented 4 months ago

Does passing --locked fix it for you?

The Cargo team generally assumes project lockfiles are compatible with their MSRV and recommend using --locked in these cases.

If wasm-pack doesn't maintain an MSRV then I recommend reaching out to them but pining to a specific version (cargo install --locked wasm-pack@1.5.0, version is made up) that works for you should still do.

Alternatively, if there is cargo-bin-install support (third party tool and cache) then you don't need to worry about MSRV.

digitalmoksha commented 4 months ago

Thank you, using --locked did it (cargo install --locked wasm-pack@0.12.1).

TIL 🙇

epage commented 4 months ago

Cargo should have recommended passing --locked in the error message:

package `{}` cannot be built because it requires rustc {} or newer, 
while the currently active rustc version is {}
Try re-running cargo install with `--locked`