-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
cargo add
takes package.rust-version
into account when no version-req is specified
#10653
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
added
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-add
labels
May 11, 2022
See also killercup/cargo-edit#587 |
When |
27 tasks
bors
added a commit
that referenced
this issue
Apr 28, 2023
feat: Add `-Zmsrv-policy` feature flag ### What does this PR try to resolve? Nothing noticeable.... The intent is to unblock experiments with different compatible MSRV policies like - #9930 - #10653 - #10903 While I normally don't like PRs that do nothing on their own, this at least allows any one of those efforts to move forward with different people without juggling these base commits for whoever is first to include in their PR While there isn't an RFC for this yet, this is intended to allow us to experiment to get a better idea of what we should put in an RFC. In some cases, we first do an eRFC for this but I assumed this wouldn't be needed in this case as this builds on rust-lang/rfcs#2495 and, I'm assuming, will be more surgical in nature ### How should we test and review this PR? The `Summary` changes are largely untested as they will be mostly tested through the future work that builds on this PR. However, I wasn't too concerned about that because the code is relatively trivial. ### Additional information I chose the name `msrv-policy` to distinguish this unstable feature from `rust-version`. Though those appear in different places (`Cargo.toml` vs `-Z`), I can see them being confusing which was especially apparent when editing `unstable.md` which has an anchor for `rust-version`.
@rustbot claim |
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 2, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 3, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 4, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 15, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 18, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
cassaundra
added a commit
to cassaundra/cargo
that referenced
this issue
May 23, 2023
When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. Implements rust-lang#10653.
bors
added a commit
that referenced
this issue
May 23, 2023
Consider rust-version when selecting packages for cargo add When `-Zmsrv-policy` is enabled, try to select dependencies which satisfy the target package's `rust-version` field (if present). If the selected version is not also the latest, emit a warning to the user about this discrepancy. Dependency versions without a `rust-version` are considered compatible by default. One remaining question is whether we should go into more detail when explaining the discrepancy and ways to resolve it to the user. For example: ``` warning: selecting older version of `fancy-dep` to satisfy the minimum supported rust version note: version 0.1.2 of `fancy-dep` has an MSRV of 1.72, which is greater than this package's MSRV of 1.69 ``` Implements #10653. r? `@epage`
Implemented in #12078. Maybe close? |
Implemented but not stable so this works as a place to track stabilization. I should update the issue to reflect that though. |
I've moved stabilization tracking to #9930 as part of rust-lang/rfcs#3537 |
bors
added a commit
that referenced
this issue
Mar 3, 2024
feat(add): Fallback to `rustc -v` when no MSRV is set ### What does this PR try to resolve? #10653 made version-requirement selection respect MSRV as part of #9930. This updates the implementation for the now-approved RFC specifies that we should respect `rustc -v` if there is no MSRV. The messages also get a little bit of polish. ### How should we test and review this PR? Tests are added in separate commits for easier viewing of behavior changes. ### Additional information
# for free
to join this conversation on GitHub.
Already have an account?
# 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
-Zmsrv-policy
Problem
When running
cargo add foo
, we create a version-req out of the latest version in the index. If this has a higherrust-version
, then that can break for people.Proposed Solution
Constrain the candidate versions in the index by their
rust-version
being lesser or equal to the current crate'srust-version
.The main question is what to do when there are no matches due to
rust-version
.rust-version
Notes
No response
The text was updated successfully, but these errors were encountered: