Cargo tree -d strange output

I not use cargo tree -d for long time.
I have workspace Cargo with resolver = "2",
and want to see all duplicates in dependency tree for one crate from workspace.

But cargo tree -d show strange things, like:

libc v0.2.148 
libc v0.2.148 

and no other mention of libc

rustix v0.38.14 (*)                                                                                                                                                                        
rustix v0.38.14 (*)   

and no other version of rustic.

In other words cargo tree -d for some reasons thinks that the same versions of crates are duplicates.

Is this because of set of features are different for this libc and rustix (these creates are introduced via build/dev/normal dependicies, so I suppose with resolover=2 they can have different features enabled) ?
How can I see what is difference of enabled/disabled features?

1 Like

Yes, you can find a list of cases where the new resolver doesn't unify features here: Dependency Resolution - The Cargo Book

You can use cargo tree -e features to show the enabled features of a crate in the tree. This doesn't work with the -d/--duplicates flag though, so you probably have to use a tool like grep to filter the output for libc and rustix, if your tree is large.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.