-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 package@version shows features from oldest instead of current version #11073
Comments
This was intentionally done to point out what features will be safe to use across whatever version of |
It would be better to make it obvious this is the intended behavior, because it was very surprising as it is. In my mind ideally it would show the union of these lists and make it clear which features are new in the latest version compared to the specified version. |
Any suggestions for how to make this obvious? My main concern is how well it "fits" without adding extra noise. |
Maybe a suffix like I guess a challenge is that a feature could be disabled by default in 0.4 and enabled in 0.4.22 (the other way around could happen too but probably not so likely?), so that the +/- value should be different across versions. |
I feel like that adds too much noise. What about something more basic like:
|
Well, it would just show the two features, right? Maybe it could at least also have a line saying "(17 more features available in current version 0.4.22)"? |
Yup, copied the wrong one. That I also lean towards being too much |
This gives a hint to users that we might not be showing the feature list for the latest version but the earliest version. Also when using a workspace dependency or re-using an existing dependency, this is a good reminder of what the version requirement is that was selected. However, when the user or add (the common case) selected a full precision requirement, this is redundant. I'm also mixed on whether the meta version should show up. Fixes rust-lang#11073
fix(add): Clarify which version the features are added for ### What does this PR try to resolve? This gives a hint to users that we might not be showing the feature list for the latest version but the earliest version. Also when using a workspace dependency, this is a good reminder of what the version requirement is that was selected. That could also be useful for reused dependencies but didn't want to bother with the relevant plumbing for that. ie we are going from ```console $ cargo add [email protected] Updating crates.io index Adding chrono v0.4 to dependencies. Features: - rustc-serialize - serde ``` to ```console $ cargo add [email protected] Updating crates.io index Adding chrono v0.4 to dependencies. Features as of v0.4.2: - rustc-serialize - serde ``` ### How should we test and review this PR? I'd recommend looking at this commit-by-commit. This is broken up into several refactors leading up the main change. The refactors are focused on pulling UI logic out of dependency editing so we can more easily evolve the UI without breaking the editing API. I then tweaked the behavior in the final commit to be less redundant / noisy. The existing tests are used to demonstrate this is working. ### Additional information I'm also mixed on whether the meta version should show up. Fixes #11073
This gives a hint to users that we might not be showing the feature list for the latest version but the earliest version. Also when using a workspace dependency or re-using an existing dependency, this is a good reminder of what the version requirement is that was selected. However, when the user or add (the common case) selected a full precision requirement, this is redundant. I'm also mixed on whether the meta version should show up. Fixes rust-lang#11073
This gives a hint to users that we might not be showing the feature list for the latest version but the earliest version. Also when using a workspace dependency or re-using an existing dependency, this is a good reminder of what the version requirement is that was selected. However, when the user or add (the common case) selected a full precision requirement, this is redundant. I'm also mixed on whether the meta version should show up. Fixes rust-lang#11073
Problem
When adding
cargo add
with an explicit minimal version,cargo add
will show features from the specific version, while actually adding the latest semver-compatible version. This seems misleading and/or confusing.Steps
cargo add [email protected]
Actual result:
Expected result:
This is the output from
cargo add [email protected]
, which is the version thatadd [email protected]
actually pulls in at this time.Possible Solution(s)
Bump the version to the latest semver-compatible one before extracting features, instead of after.
Version
The text was updated successfully, but these errors were encountered: