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

refactor: Pull out cargo-add MSRV code for reuse #12553

Merged
merged 3 commits into from
Aug 25, 2023
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Aug 24, 2023

What does this PR try to resolve?

#12078 added MSRV code in cargo add. Our assumption when writing it is that we'd need to generalize the code before reusing it in other places, like cargo install. This PR focused purely on that refactor because I'm hopeful it will be useful for other work I'm doing. Despite not having a user for this yet, I think the cargo install case is inevitable and I feel this does a bit to clean up MSRV related code by using a more specific type everywhere.

How should we test and review this PR?

Each commit gradually progresses things along

epage added 2 commits August 24, 2023 13:13
By using the `PartialVersion` type with serde, we get the context for
the error automatically.
@rustbot
Copy link
Collaborator

rustbot commented Aug 24, 2023

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-dependency-resolution Area: dependency resolution and the resolver A-interacts-with-crates.io Area: interaction with registries A-manifest Area: Cargo.toml issues A-registries Area: registries A-semver Area: semver specifications, version matching, etc. Command-add Command-publish S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 24, 2023
Since we have tests for a couple of cases, I figured we could
improve the error messages for them.
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The review comments aren't really important. Feel free to mark as resolved and I'll come back and merge.

src/cargo/util/semver_ext.rs Outdated Show resolved Hide resolved
src/cargo/util/semver_ext.rs Outdated Show resolved Hide resolved
src/cargo/util/semver_ext.rs Outdated Show resolved Hide resolved
src/cargo/ops/registry/publish.rs Outdated Show resolved Hide resolved
src/cargo/util/semver_ext.rs Show resolved Hide resolved
@epage epage force-pushed the version branch 2 times, most recently from 36cf9cd to 1701b4e Compare August 25, 2023 14:34
@weihanglo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Aug 25, 2023

📌 Commit 1701b4e has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2023
@bors
Copy link
Contributor

bors commented Aug 25, 2023

⌛ Testing commit 1701b4e with merge f797978...

@bors
Copy link
Contributor

bors commented Aug 25, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing f797978 to master...

@bors bors merged commit f797978 into rust-lang:master Aug 25, 2023
@epage epage deleted the version branch August 25, 2023 15:43
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 26, 2023
Update cargo

13 commits in 2cc50bc0b63ad20da193e002ba11d391af0104b7..925280f028db3a322935e040719a0754703947cf
2023-08-22 22:43:08 +0000 to 2023-08-25 21:16:44 +0000
- string leek is stable (rust-lang/cargo#12559)
- refactor: Pull out cargo-add MSRV code for reuse (rust-lang/cargo#12553)
- Contrib: Add process for security responses. (rust-lang/cargo#12487)
- Support dependencies from registries for artifact dependencies, take 2 (rust-lang/cargo#12421)
- fix(toml): Improve parse errors (rust-lang/cargo#12556)
- Create dedicated unstable flag for asymmetric-token (rust-lang/cargo#12551)
- chore(deps): update latest msrv to v1.72.0 (rust-lang/cargo#12549)
- changelog: add link to CVE-2023-40030 (rust-lang/cargo#12550)
- refactor(install): Move value parsing to clap (rust-lang/cargo#12547)
- fix: Set MSRV for internal packages (rust-lang/cargo#12381)
- doc: fix two links to tracing docs (rust-lang/cargo#12537)
- use AND search when having multiple terms (rust-lang/cargo#12548)
- fix(log): Use a more compact relative-time format (rust-lang/cargo#12542)

r? ghost
@ehuss ehuss added this to the 1.74.0 milestone Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-dependency-resolution Area: dependency resolution and the resolver A-interacts-with-crates.io Area: interaction with registries A-manifest Area: Cargo.toml issues A-registries Area: registries A-semver Area: semver specifications, version matching, etc. Command-add Command-publish S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants