Skip to content

cargo tree --duplicates --target all non-deterministic output #15366

@ratmice

Description

@ratmice

Problem

I have been working on reducing duplicate dependencies from a crate.
However I noticed that the output of cargo -tree --duplicates --target all
sometimes changes between printing a bunch of duplicates of the same version,
and printing warning: nothing to print

$ cargo tree --duplicates --target all

warning: nothing to print.

To find dependencies that require specific target platforms, try to use option `--target all` first, and then narrow your search scope accordingly.

I'm going to snip the output, but other times I see (what I believe different feature usage of a few crates between build-time and compile time)

$ cargo tree --duplicates --target all

syn v2.0.100
...

syn v2.0.100
...

windows-sys v0.59.0
...

windows-sys v0.59.0

I would expect cargo tree to print deterministic output when invoked.
The output seems to go through "phases", e.g. If you invoke it fast enough
you'll get a few instances of duplicates, followed by a few info instances of "warning: nothing to print".

But doesn't seem to be affected by whether rust-analyzer is running.

cargo 1.85.0 (d73d2ca 2024-12-31)

Steps

git clone -b unstable_cargo_tree https://github.com/ratmice/grmtools.git
cd grmtools/
cargo tree --duplicates --target all
cargo tree --duplicates --target all

repeat the last two steps until you see both output results.

Possible Solution(s)

No response

Notes

No response

Version


Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-treeS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions