Skip to content

fix(path): clarify error message when path dependency has wrong package#16927

Merged
epage merged 3 commits into
rust-lang:masterfrom
raushan728:fix-15296
Jul 22, 2026
Merged

fix(path): clarify error message when path dependency has wrong package#16927
epage merged 3 commits into
rust-lang:masterfrom
raushan728:fix-15296

Conversation

@raushan728

@raushan728 raushan728 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

View all comments

Fixes #15296

When a path dependency points to a directory with a wrong or missing package, Cargo now scans subdirectories and shows helpful hints about what packages exist nearby.

@rustbot rustbot added A-dependency-resolution Area: dependency resolution and the resolver S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2026
@rustbot

rustbot commented Apr 22, 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

@epage epage left a comment

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.

Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/sources/path.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread tests/testsuite/path.rs Outdated
@rustbot rustbot added the A-registries Area: registries label Apr 23, 2026
@raushan728

This comment has been minimized.

@raushan728
raushan728 requested a review from epage April 23, 2026 12:47
Comment thread src/cargo/core/resolver/errors.rs
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/resolver/errors.rs Outdated
Comment thread src/cargo/core/registry.rs Outdated
@raushan728
raushan728 force-pushed the fix-15296 branch 3 times, most recently from d5f8d89 to 603d687 Compare April 24, 2026 06:58
@raushan728

This comment was marked as duplicate.

@raushan728
raushan728 requested a review from epage April 26, 2026 14:48
Comment thread src/resolver/errors.rs
Comment thread src/cargo/core/resolver/errors.rs Outdated
@rustbot

This comment has been minimized.

@raushan728

Copy link
Copy Markdown
Contributor Author

Since PathSource::query() now returns zero candidates for missing Cargo.toml instead of an IO error, some existing tests that expected the old error chain now show the resolver-level error message instead.

@raushan728
raushan728 force-pushed the fix-15296 branch 2 times, most recently from 94076b6 to fb20a60 Compare May 1, 2026 08:54
@raushan728
raushan728 requested a review from epage May 1, 2026 09:20
@rustbot

This comment has been minimized.

Comment thread src/cargo/sources/path.rs Outdated
Comment thread src/sources/path.rs
Comment thread src/cargo/sources/path.rs Outdated
@rustbot

This comment has been minimized.

@raushan728
raushan728 force-pushed the fix-15296 branch 2 times, most recently from 142213e to 2fb9cd0 Compare May 12, 2026 06:53
@raushan728
raushan728 requested a review from epage May 12, 2026 07:23
@rustbot

This comment has been minimized.

@raushan728 raushan728 closed this May 14, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2026
@raushan728 raushan728 reopened this May 14, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2026
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

Track missing Cargo.toml state using Option<Option<Package>>, where
outer None means unloaded and inner None means loaded but missing.
This allows the resolver to produce standard diagnostics instead of
raw IO error chains.
@rustbot

rustbot commented Jul 19, 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.

- Scan subdirectories when a path dependency is missing or invalid.

- Show helpful hints suggesting packages that exist nearby.

@epage epage left a comment

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.

@epage
epage added this pull request to the merge queue Jul 22, 2026
Merged via the queue into rust-lang:master with commit 5b6fca7 Jul 22, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 22, 2026
@raushan728
raushan728 deleted the fix-15296 branch July 24, 2026 05:20
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 25, 2026
Update cargo submodule

17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed
2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000
- chore: bump to `[email protected]+1.9.6` (rust-lang/cargo#17259)
- Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258)
- fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927)
- fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051)
- fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256)
- test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253)
- fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252)
- fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251)
- fix(git): Hide git fetch output without progress  (rust-lang/cargo#17243)
- revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249)
- fix: Add haiku's dylib path (rust-lang/cargo#17248)
- Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247)
- refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240)
- fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238)
- Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236)
- chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237)
- rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234)

r? ghost
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 25, 2026
Update cargo submodule



17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed
2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000
- chore: bump to `[email protected]+1.9.6` (rust-lang/cargo#17259)
- Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258)
- fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927)
- fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051)
- fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256)
- test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253)
- fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252)
- fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251)
- fix(git): Hide git fetch output without progress  (rust-lang/cargo#17243)
- revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249)
- fix: Add haiku's dylib path (rust-lang/cargo#17248)
- Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247)
- refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240)
- fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238)
- Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236)
- chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237)
- rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-dependency-resolution Area: dependency resolution and the resolver A-registries Area: registries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when wrong package found in a path dependency

3 participants