How to discover crate features in Rust 1.74

There is a change in cargo with Rust 1.74. If you add a dependency via "crate add", not all features are displayed anymore - if there are too many features.

Details are discussed here: https://github.com/rust-lang/cargo/issues/12617

All you get is the number of deactivated features. (example below)

I understand that so far. But what is the best and most convenient way to check the features of the added crate?

$ cargo add sqlx
    Updating crates.io index
      Adding sqlx v0.7.2 to dependencies.
             Features:
             + any
             + json
             + macros
             + migrate
             + sqlx-macros
             28 deactivated features
    Updating crates.io index
1 Like

One way is to check on the excellent lib.rs website: Feature flags of SQLx crate.

It's outside the cargo add workflow though, so it's probably not what you were looking for.

3 Likes

The basic source of truth is always a package's Cargo.toml file, as that is where features are declared (i.e. Rust code only uses already-declared features).
So that's always an option.