Skip to content

test: show some odd --precise cases#17082

Merged
epage merged 2 commits into
rust-lang:masterfrom
weihanglo:precise
Jun 7, 2026
Merged

test: show some odd --precise cases#17082
epage merged 2 commits into
rust-lang:masterfrom
weihanglo:precise

Conversation

@weihanglo

Copy link
Copy Markdown
Member

What does this PR try to resolve?

Unsure if these cases show the intended behavior or bugs
This PR just pins down today's behavior.

(And yeah we don't like --precise 😬)

This was found during my experiment of moving yanked handling out from source query.

How to test and review this PR?

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 6, 2026
@rustbot

rustbot commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage

@weihanglo weihanglo force-pushed the precise branch 2 times, most recently from 0358aa5 to abe2790 Compare June 6, 2026 17:16
@rustbot

rustbot commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread tests/testsuite/update.rs Outdated

#[cargo_test]
fn precise_with_multiple_specs() {
// As of 71b70c095bb15e278ab9f0f808397c8033079888,

@epage epage Jun 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need a commit sha? CI enforces the state of the tests is synchronized.

View changes since the review

Comment thread tests/testsuite/update.rs Outdated
// only the first SPEC ends up with `--precise` applied to it.
// Subsequent SPECs are silently ignored.
//
// Unsure if it is intended or an overlook or a bug.

@epage epage Jun 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we lead with this? If I make a change that changes this and the test fails, then I am likely to miss this at the end of this message.

View changes since the review

Comment thread tests/testsuite/update.rs Outdated
#[cargo_test]
fn precise_with_multiple_specs() {
// As of 71b70c095bb15e278ab9f0f808397c8033079888,
// when multiple SPECs share the same registry source,

@epage epage Jun 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should these be doc comments? To me, I glossed over them, as they look like comments on the packages and not comments on the whole test.

View changes since the review

Comment thread tests/testsuite/update.rs
p.cargo("generate-lockfile").run();
let lockfile_before = p.read_lockfile();

p.cargo("update -p itoa -p ryu --precise 2.0.0")

@epage epage Jun 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we cover reversing the order?

View changes since the review

@weihanglo

Copy link
Copy Markdown
Member Author

All review comments are addressed.

@epage epage added this pull request to the merge queue Jun 7, 2026
Merged via the queue into rust-lang:master with commit 8dc563b Jun 7, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 7, 2026
pull Bot pushed a commit to Mu-L/cargo that referenced this pull request Jun 10, 2026
### What does this PR try to resolve?

This PR moves move yank policy to resolver layer from source layer.

We mostly preserve the old `Source::query` behavior that filter out
yanked by default.

The yanking policy logic doesn't go into `VersionPreferences` or
`sort_summaries` yet because

* We want to minimize the refactor change. Changing the order of query
and filter may change existing diagnostics
* `[replace]` resolution should not see yanked candidates either
* A future `VersionPreferences` predicate may still need to be invoked
at this same point.

cc rust-lang#17012,
rust-lang#17014 (comment)

### How to test and review this PR?

Three tests are added to pin down more existing tests, along with
rust-lang#17082

Here is the list of all call site I audit:

| Call site | Yanked versions handling |
| --------- | ------------------------ |
| [`core/resolver/dep_cache.rs`
`query`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/resolver/dep_cache.rs#L64)
| Filter |
| [`core/resolver/dep_cache.rs` `[replace]`
override](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/resolver/dep_cache.rs#L91)
| Filter |
| [`core/registry.rs` `patch`
collection](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/registry.rs#L383)
| Filter |
| [`core/registry.rs`
`query_overrides`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/registry.rs#L553)
| Filter |
| [`core/registry.rs` `summary_for_patch`
unlocked-retry](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/registry.rs#L965)
| Filter |
| [`core/registry.rs` `summary_for_patch` name-only
diagnostic](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/registry.rs#L998)
| Filter |
| [`core/resolver/errors.rs`
`alt_versions`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/resolver/errors.rs#L432)
| Filter |
| [`core/resolver/errors.rs`
`rejected_versions`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/resolver/errors.rs#L450)
| Keep |
| [`core/resolver/errors.rs`
`alt_names`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/resolver/errors.rs#L469)
| Keep |
| [`ops/common_for_install_and_uninstall.rs` `select_dep_pkg`
(x2)](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/common_for_install_and_uninstall.rs#L611)
| Filter |
| [`ops/cargo_update.rs`
`upgrade_dependency`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/cargo_update.rs#L373)
| Filter |
| [`ops/cargo_update.rs` `report_latest`
(x4)](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/cargo_update.rs#L791)
| Filter |
| [`ops/cargo_add/mod.rs`
`get_latest_dependency`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/cargo_add/mod.rs#L823)
| Filter |
| [`ops/cargo_add/mod.rs`
`select_package`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/cargo_add/mod.rs#L952)
| Filter |
| [`ops/cargo_add/mod.rs`
`populate_available_features`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/cargo_add/mod.rs#L1180)
| Filter |
| [`ops/registry/info/mod.rs`
`query_summaries`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/registry/info/mod.rs#L215)
| Filter |
| [`ops/registry/publish.rs`
`poll_one_package`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/registry/publish.rs#L439)
| Filter |
| [`ops/registry/publish.rs`
`verify_unpublished`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/ops/registry/publish.rs#L451)
| Filter |
| [`core/compiler/future_incompat.rs`
`get_updates`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/src/cargo/core/compiler/future_incompat.rs#L334)
| Filter |
| [`crates/xtask-bump-check/src/xtask.rs`
`check`](https://github.com/rust-lang/cargo/blob/71b70c095bb15e278ab9f0f808397c8033079888/crates/xtask-bump-check/src/xtask.rs#L448)
| Filter |
@weihanglo weihanglo deleted the precise branch June 10, 2026 23:41
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 11, 2026
Update cargo submodule

11 commits in 0b1123a48825309b697312b44fdb64b3df00c958..fe63976b245b8a649c3f2949bf89fdc307bfbae4
2026-06-01 21:20:28 +0000 to 2026-06-11 09:17:57 +0000
- refactor: reduce use `Summary::{as_summary,into_summary}` (rust-lang/cargo#17092)
- docs(diag): Provide jumping off points for writing diagnostics and passes (rust-lang/cargo#17090)
- refactor(source): drop `Source::is_yanked` (rust-lang/cargo#17091)
- refactor(resolver): move yank policy to resolver layer  (rust-lang/cargo#17083)
- fix(publish): avoid false deadlock when to_confirm is non-empty (rust-lang/cargo#17071)
- doc(guide): use fresh actions/checkout version in GH actions examples (rust-lang/cargo#17087)
- fix: strip CR from `cargo:token-from-stdout` (rust-lang/cargo#17081)
- test: show some odd `--precise` cases (rust-lang/cargo#17082)
- chore(deps): update rust crate gix to 0.84.0 (rust-lang/cargo#17063)
- refactor: drop `yanked_whitelist` from source loading (rust-lang/cargo#17014)
- chore(deps): update msrv to v1.96 (rust-lang/cargo#17041)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 11, 2026
Update cargo submodule

11 commits in 0b1123a48825309b697312b44fdb64b3df00c958..fe63976b245b8a649c3f2949bf89fdc307bfbae4
2026-06-01 21:20:28 +0000 to 2026-06-11 09:17:57 +0000
- refactor: reduce use `Summary::{as_summary,into_summary}` (rust-lang/cargo#17092)
- docs(diag): Provide jumping off points for writing diagnostics and passes (rust-lang/cargo#17090)
- refactor(source): drop `Source::is_yanked` (rust-lang/cargo#17091)
- refactor(resolver): move yank policy to resolver layer  (rust-lang/cargo#17083)
- fix(publish): avoid false deadlock when to_confirm is non-empty (rust-lang/cargo#17071)
- doc(guide): use fresh actions/checkout version in GH actions examples (rust-lang/cargo#17087)
- fix: strip CR from `cargo:token-from-stdout` (rust-lang/cargo#17081)
- test: show some odd `--precise` cases (rust-lang/cargo#17082)
- chore(deps): update rust crate gix to 0.84.0 (rust-lang/cargo#17063)
- refactor: drop `yanked_whitelist` from source loading (rust-lang/cargo#17014)
- chore(deps): update msrv to v1.96 (rust-lang/cargo#17041)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 11, 2026
Update cargo submodule

11 commits in 0b1123a48825309b697312b44fdb64b3df00c958..fe63976b245b8a649c3f2949bf89fdc307bfbae4
2026-06-01 21:20:28 +0000 to 2026-06-11 09:17:57 +0000
- refactor: reduce use `Summary::{as_summary,into_summary}` (rust-lang/cargo#17092)
- docs(diag): Provide jumping off points for writing diagnostics and passes (rust-lang/cargo#17090)
- refactor(source): drop `Source::is_yanked` (rust-lang/cargo#17091)
- refactor(resolver): move yank policy to resolver layer  (rust-lang/cargo#17083)
- fix(publish): avoid false deadlock when to_confirm is non-empty (rust-lang/cargo#17071)
- doc(guide): use fresh actions/checkout version in GH actions examples (rust-lang/cargo#17087)
- fix: strip CR from `cargo:token-from-stdout` (rust-lang/cargo#17081)
- test: show some odd `--precise` cases (rust-lang/cargo#17082)
- chore(deps): update rust crate gix to 0.84.0 (rust-lang/cargo#17063)
- refactor: drop `yanked_whitelist` from source loading (rust-lang/cargo#17014)
- chore(deps): update msrv to v1.96 (rust-lang/cargo#17041)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 11, 2026
Update cargo submodule

11 commits in 0b1123a48825309b697312b44fdb64b3df00c958..fe63976b245b8a649c3f2949bf89fdc307bfbae4
2026-06-01 21:20:28 +0000 to 2026-06-11 09:17:57 +0000
- refactor: reduce use `Summary::{as_summary,into_summary}` (rust-lang/cargo#17092)
- docs(diag): Provide jumping off points for writing diagnostics and passes (rust-lang/cargo#17090)
- refactor(source): drop `Source::is_yanked` (rust-lang/cargo#17091)
- refactor(resolver): move yank policy to resolver layer  (rust-lang/cargo#17083)
- fix(publish): avoid false deadlock when to_confirm is non-empty (rust-lang/cargo#17071)
- doc(guide): use fresh actions/checkout version in GH actions examples (rust-lang/cargo#17087)
- fix: strip CR from `cargo:token-from-stdout` (rust-lang/cargo#17081)
- test: show some odd `--precise` cases (rust-lang/cargo#17082)
- chore(deps): update rust crate gix to 0.84.0 (rust-lang/cargo#17063)
- refactor: drop `yanked_whitelist` from source loading (rust-lang/cargo#17014)
- chore(deps): update msrv to v1.96 (rust-lang/cargo#17041)
@rustbot rustbot added this to the 1.98.0 milestone Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants