est31 / cargo-udeps

Find unused dependencies in Cargo.toml
Other
1.76k stars 46 forks source link

Support for Rust 2021 Edition #101

Closed rkfox closed 3 years ago

rkfox commented 3 years ago

I am getting an error on projects that use the 2021 edition of rust. I am using Rust v1.57.0. I get this error:

error: failed to parse manifest at /home/john/projects/test/Cargo.toml

Caused by:
  feature `edition2021` is required

  The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0).
  Consider adding `cargo-features = ["edition2021"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.
est31 commented 3 years ago

Thanks for the report! This is mainly an upstream issue in cargo. According to their official schedule, it's only possible to use edition 2021 without a feature gate when using the 0.57.0 crates.io release of the cargo crate, corresponding to the 1.56.0 release of rustc and cargo (I know it's a bit complicated). This release occurs on October 21, and until then the crate isn't published on crates.io. So there is nothing much we can do here. However, note that it's possible to replace the crates.io cargo dependency in the cargo-udeps repository with a git dependency from the beta branch.

Given the significance of the 2021 edition, I'm wondering whether to make a policy exception and use cargo from git in this instance.

est31 commented 3 years ago

Alright I've pushed dece8b22610bca73bb76e4f8a038d548cb7b02a0 . You can install cargo-udeps that supports edition 2021 from git using a command like:

cargo install --git https://github.com/est31/cargo-udeps

Have fun!

Madoshakalaka commented 2 years ago

For later people that are here, I can confirm 0.1.25 works with edition=2021. so just cargo install cargo-udeps is fine