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 add clap@4.1.3 lock to the version specific #11687

Open
epage opened this issue Feb 7, 2023 · 2 comments
Open

cargo add clap@4.1.3 lock to the version specific #11687

epage opened this issue Feb 7, 2023 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add

Comments

@epage
Copy link
Contributor

epage commented Feb 7, 2023

Problem

If I'm explicitly setting the version requirement, there is likely a reason for it, like MSRV. I shouldn't have to then run cargo update -p clap --precise 4.1.3 after running cargo add.

Proposed Solution

When the version requirement is precise, lock to it

Notes

I implemented support for this in cargo-edit's cargo upgrade, see killercup/cargo-edit#795

@epage epage added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add labels Feb 7, 2023
@weihanglo
Copy link
Member

weihanglo commented Feb 28, 2023

If we open a URL on crates.io with a precise version, for example https://crates.io/crates/cargo/0.68.0, it will hint us with cargo add cargo@0.68.0.

image

As a new Rust user, I might just copy the command and then be locked to that version forever accidentally, if this feature gets landed.

The idea is that, users could copy a command from anywhere without thinking about it.

@epage
Copy link
Contributor Author

epage commented Feb 28, 2023

So long as we don't commit lockfiles for libs by default, this will only affect programs and only until the user does a cargo update, so I don't think it is all that bad.

I also suspect going to a specific version's page or someone including @ is less likely to happen.

The counter to this is the user intending a specific version and not getting it, like for MSRV.

However, how we handle this is dependent on how we expose #5657 to the user, so I don't think any action should be taken on this until then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add
Projects
None yet
Development

No branches or pull requests

2 participants