cargo-msrv icon indicating copy to clipboard operation
cargo-msrv copied to clipboard

Find the MSRV based on the known rust-version in the dependency tree

Open foresterre opened this issue 2 years ago • 3 comments

  • [x] Find dependencies (e.g. cargo metadata or cargo guppy via cargo metadata)
  • [x] For each dependency:
    • [ ] read package.rust-version or else package.metadata.msrv
  • [ ] select min(dependency min versions)
cargo msrv list
  Lists the msrv's of all (transitive) dependencies, and computes the MSRV based on these values
  --include-dev
  --no-transitive
  --no-compute-msrv

foresterre avatar Oct 25 '21 01:10 foresterre

Both 1.56 and 1.57-beta currently do not have the "rust_version" field in the cargo metadata. It does however exist in nightly Cargo.

My suggestion would be to currently simply work-around this problem, and use cargo metadata (or guppy :D) to get the manifest, and then parse the field ourselves. For cargo versions >= versions which do include the field, we can then rely on cargo metadata, and at that time use this first solution as a fallback.

foresterre avatar Oct 27 '21 23:10 foresterre

https://docs.rs/guppy/0.11.2/guppy/graph/struct.PackageMetadata.html#method.manifest_path

foresterre avatar Oct 27 '21 23:10 foresterre

cargo msrv list now can do most of this, although it would be nice to also have a more general table with | crate name | version | is in(direct) | MSRV |

foresterre avatar Nov 01 '21 23:11 foresterre