rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.58k stars 2.38k forks source link

cargo shows that `tokio` with the `default` feature depends on `mio`, which is incorrect. #14263

Open themighty1 opened 1 month ago

themighty1 commented 1 month ago

When running cargo tree on my project, mio is shown as a dependency of tokio with the default feature, which is incorrect, since mio is tokio's optional dependendy only for features net, process, signal (as per https://github.com/tokio-rs/tokio/blob/master/tokio/Cargo.toml)

To reproduce: (EDITED to reflect the recent dir reorg)

git clone https://github.com/tlsnotary/tlsn
cd tlsn
git checkout 68b9474015b817255c226fec38e80addd16191d1
cd components/tls/tls-mpc/
cargo tree -e normal,dev,features | grep mio -B10

you will see this Screenshot from 2024-07-18 09-12-57

eth3lbert commented 1 month ago

I think the default here refers to the default of package(tlsn-utils-aio) that enables tokio.

themighty1 commented 1 month ago

@eth3lbert , are you suggesting that tokio feature "default" means something else other than the default feature of the tokio crate? I don't think that's how cargo tree works. It only shows the enabled features of this dependency, i.e. of the dependency mentioned on the same line as the feature.

Or amiwrong?

eth3lbert commented 1 month ago

You could try using inverse mode with cargo tree -e features -p mio -i. This might make more sense to you.

ehuss commented 1 month ago

@eth3lbert There is something definitely wrong in the tree output. For example, the "tokio feature "net" edge is completely missing. All optional dependencies should have a feature edge to them to explain why they are enabled. I don't know what is going wrong, it will take some investigation why the feature edges are missing.

Rustin170506 commented 1 month ago

@rustbot claim

I will take a look.