Allow precise update to prerelease.#13626
Conversation
|
I don't think I will be able to give this the attention it deserves until well after Rust Nation. But from a quick perusal it looks like a really good start. Thank you! |
|
Do we have tests for checking the feature gate work and doesn't leak on stable? Like prerelease would not be selected without the flag. We may already have. Need to check. |
|
This |
That had been my expectation |
I already changed it by the way. |
weihanglo
left a comment
There was a problem hiding this comment.
Thanks for this!
Could we also have a doc update as well?
src/doc/man/cargo-update.md
Outdated
| When possible, try other non-yanked SemVer-compatible versions or seek help | ||
| from the maintainers of the package. | ||
|
|
||
| It's allows you choose any compatible `pre-release` version (nightly only) even when a pre-release is not specified by a projects `Cargo.toml`. |
There was a problem hiding this comment.
| It's allows you choose any compatible `pre-release` version (nightly only) even when a pre-release is not specified by a projects `Cargo.toml`. | |
| A compatible `pre-release` version can also be specified even when the version requirement in `Cargo.toml` doesn't contain any pre-release identifer (nightly only). |
There was a problem hiding this comment.
Good annotations have always been my weakness, thank you for correcting this description.
src/cargo/sources/registry/mod.rs
Outdated
| .filter(|(c, _)| { | ||
| if self.gctx.cli_unstable().unstable_options { |
There was a problem hiding this comment.
I don't know how match_prerelease will evolve, so it's better to have a check here maybe?
| .filter(|(c, _)| { | |
| if self.gctx.cli_unstable().unstable_options { | |
| .filter(|(c, to)| { | |
| if to.is_prerelease() && self.gctx.cli_unstable().unstable_options { |
There was a problem hiding this comment.
Your concern makes sense.
src/cargo/sources/registry/mod.rs
Outdated
| let matched = match kind { | ||
| QueryKind::Exact => dep.matches(s.as_summary()), | ||
| QueryKind::Exact => { | ||
| if self.gctx.cli_unstable().unstable_options { |
There was a problem hiding this comment.
Same here. We might want this check to prevent any regression in the future, if some underlying functions change.
| if self.gctx.cli_unstable().unstable_options { | |
| if req.is_precise() && self.gctx.cli_unstable().unstable_options { |
weihanglo
left a comment
There was a problem hiding this comment.
Thanks. The only missing piece is updating the unstable doc here to -Zunstable-options:
cargo/src/doc/src/reference/unstable.md
Line 350 in f4ea1d1
|
Thanks! @bors r+ |
|
☀️ Test successful - checks-actions |
Update cargo 9 commits in 0637083df5bbdcc951845f0d2eff6999cdb6d30a..28e7b2bc0a812f90126be30f48a00a4ada990eaa 2024-04-02 23:55:05 +0000 to 2024-04-05 19:31:01 +0000 - refactor(toml): Decouple target discovery from Target creation (rust-lang/cargo#13701) - Don't depend on `?` affecting type inference in weird ways (rust-lang/cargo#13706) - test(metadata): Show behavior with TOML-specific types (rust-lang/cargo#13703) - fix: adjust tracing verbosity in list_files_git (rust-lang/cargo#13704) - doc: comments on `PackageRegistry` (rust-lang/cargo#13698) - Switch to using gitoxide by default for listing files (rust-lang/cargo#13696) - Allow precise update to prerelease. (rust-lang/cargo#13626) - refactor(toml): Split out an explicit step to resolve `Cargo.toml` (rust-lang/cargo#13693) - chore(deps): update rust crate base64 to 0.22.0 (rust-lang/cargo#13675) r? ghost
What does this PR try to resolve?
This is a feature that attempts to support updates to pre-release versions via
cargo update --precise.when
precise-pre-releaseused, the prerelase version will be taking consider as compatible version. That said, we can update to any compatible pre-release version. The logic of checking the compatibility of pre-release versions is currently tentative and does not take many conditions into account, this part of the logic makes more sense when implemented in semver.Use
-Zunstable-optionsinstead of-Zprecise-pre-release.How should we test and review this PR?
Additional information
Part of #13290