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 -d with --target can be confusing #9519

Closed
ehuss opened this issue May 28, 2021 · 2 comments · Fixed by #10466
Closed

cargo tree -d with --target can be confusing #9519

ehuss opened this issue May 28, 2021 · 2 comments · Fixed by #10466
Assignees
Labels

Comments

@ehuss
Copy link
Contributor

ehuss commented May 28, 2021

Problem
cargo tree -d can show duplicates when used with the --target flag that, although the packages will be built twice, it is unavoidable when cross-compiling. This can be confusing because the output shows the same package twice with the same version, but no other explanation of why they are shown.

Steps
Create a manifest where a dependency shows up as both a normal dependency and a build-dependency (or proc-macro). Example:

[package]
name = "foo"
version = "0.1.0"
edition = "2018"

[dependencies]
anyhow = "1.0.40"

[build-dependencies]
anyhow = "1.0.40"

Running cargo tree -d --target x86_64-unknown-linux-gnu will show:

anyhow v1.0.40
[build-dependencies]
└── foo v0.1.0 (/Users/eric/Temp/foo)

anyhow v1.0.40
└── foo v0.1.0 (/Users/eric/Temp/foo)

Possible Solution(s)
I can think of two possible solutions:

  1. Don't treat host/target duplicates as duplicates. In essence, behave the same as without --target (but still filtering for the given target).
  2. Display some additional information (like host/target on each line).

Notes

Output of cargo version:
cargo 1.54.0-nightly (070e459 2021-05-11)

@ehuss ehuss added C-bug Category: bug Command-tree labels May 28, 2021
@Rustin170506

This comment was marked as outdated.

@Rustin170506 Rustin170506 removed their assignment Feb 22, 2022
@Rustin170506
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants