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

cargo tree gives wrong suggestion with -i on ambiguous spec #12433

Closed
tommy-gilligan opened this issue Aug 1, 2023 · 2 comments · Fixed by #12685
Closed

cargo tree gives wrong suggestion with -i on ambiguous spec #12433

tommy-gilligan opened this issue Aug 1, 2023 · 2 comments · Fixed by #12685
Assignees
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug Command-tree S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review

Comments

@tommy-gilligan
Copy link

tommy-gilligan commented Aug 1, 2023

Problem

% cargo tree -i time
error: There are multiple `time` packages in your project, and the specification `time` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  time@0.1.45
  time@0.3.23

But I never used -p

Steps

  1. Have multiple versions of a spec
  2. Run cargo tree -i $SPEC_NAME without specifying version

Possible Solution(s)

  • Make message provide advice suitable for either -i or -p case
  • Make message reflect the case in which it is being used.
  • Remove advice message

Notes

No response

Version

% cargo version --verbose
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
release: 1.71.0
commit-hash: cfd3bbd8fe4fd92074dfad04b7eb9a923646839f
commit-date: 2023-06-08
host: aarch64-apple-darwin
libgit2: 1.6.4 (sys:0.17.1 vendored)
libcurl: 8.1.2 (sys:0.4.61+curl-8.0.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1t  7 Feb 2023
os: Mac OS 14.0.0 [64-bit]
@tommy-gilligan tommy-gilligan added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Aug 1, 2023
@ehuss ehuss added A-diagnostics Area: Error and warning messages generated by Cargo itself. S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review Command-tree and removed S-triage Status: This issue is waiting on initial triage. labels Aug 2, 2023
@ehuss
Copy link
Contributor

ehuss commented Aug 2, 2023

This may be tricky or messy to try to make the error message adaptive to the correct command-line options (since it would need to be plumbed through several abstraction layers). I might just reword the error message to be more generic, maybe something like "Please re-run this command with one of the following:".

@eopb
Copy link
Contributor

eopb commented Aug 27, 2023

@rustbot claim

bors added a commit that referenced this issue Sep 18, 2023
generalise suggestion on abiguous spec

Fixes #12433
@bors bors closed this as completed in 9831e83 Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug Command-tree S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants