Cargo update recommends command to "to see how you depend on a package" that does not always work #14993
Labels
C-bug
Category: bug
Command-info
Command-tree
Command-update
S-triage
Status: This issue is waiting on initial triage.
Problem
Running cargo update recommends passing --verbose to see what packages were not updated. When this is done, it includes:
Running this command as recommended to not work in call cases.
Steps
cargo
is an example of such a repository (current master 0499e31 used to test this).cargo update --verbose
Possible Solution(s)
I see four possible fixes:
--invert
instead of using the--project
option. Then either:a. add
--all-features
since cargo update applies to all features and thus it may be required for the packages it mentions in its output. A draft showing this solution is in fix: Adjust "to see how you depend on a package" message to use a command format that supports flags like --all-features #14991b. cargo tree --inverse able to look up packages that are under a feature without the
--all-features
flag (maybe report in the output which edges are conditional on a feature)Notes
There are two ways to pass the package you want to investigate to
cargo tree --inverse
. It can be passed to the--inverse
option, or to the--package
option. Using the --package approach (as currently done) doesn't work with flags like--all-features
:This seems like a bug to me. If using invert and not providing its optional , the the --all-features argument should probably be applied to the workspace and not the package. I would expect either --invert's to be required (and not allow using --package instead) OR for using --package instead to work the same.
Personally I find --invert making the SPEC optional and allowing package to work instead to be confusing when using workspaces and features, but its an existing feature so we should probably keep it.
I also find it a bit surprising that when searching for a package that actually exists in the lock file and in the crate registry, the error says:
I think an error more like:
Would make sense in this case, and if not offline, for the case where its actually missing locally:
There is also related code which may be impacted by this issue in
cargo/src/cargo/ops/registry/info/view.rs
Lines 402 to 406 in 9b5efd9
Version
The text was updated successfully, but these errors were encountered: