Describe the bug
When the manifest dependencies contains multiple major versions with different feature sets, krates 0.16.1 produces an internal error.
thread 'test' panicked at /Users/kpreid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.16.1/src/builder.rs:715:25:
internal error: entered unreachable code: unable to locate js for crate getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index) features(["bindgen", "js-sys", "wasm-bindgen"])
stack backtrace:
0: rust_begin_unwind
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
2: krates::builder::Builder::build_with_metadata::Node::feature_index
at /Users/kpreid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.16.1/src/builder.rs:715:25
3: krates::builder::Builder::build_with_metadata
at /Users/kpreid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.16.1/src/builder.rs:1250:46
4: krates::builder::Builder::build
at /Users/kpreid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.16.1/src/builder.rs:572:9
5: krates_test_case::test
at ./src/lib.rs:7:34
6: krates_test_case::test::{{closure}}
at ./src/lib.rs:2:10
7: core::ops::function::FnOnce::call_once
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
To ReproduceCargo.toml:
[package]
name = "krates-test-case"
edition = "2021"
[dependencies]
krates = "0.16.1"
# does not have a feature called wasm-bindgen
getrandom = { version = "0.2.7", features = ["js"] }
# does not have a feature called js
getrandom_old = { package = "getrandom", version = "0.1.16", features = ["wasm-bindgen"] }
Rust code (reduced from cargo_about::get_all_crates):
#[test]
fn test() {
let mut mdc = krates::Cmd::new();
mdc.manifest_path(<&krates::Utf8Path>::from("./Cargo.toml"));
let mut builder = krates::Builder::new();
builder.include_targets([("wasm32-unknown-unknown", vec![])]);
let _graph: krates::Krates = builder.build(mdc, |_| {}).unwrap();
}
Additional context
I encountered this problem while attempting to make cargo-about use krates 0.16 to get the fix for #64. However, the bug also exists in krates@0.15.3 but not krates@0.15.1 — but this may be just because the panic was only introduced by #63.
Describe the bug When the manifest dependencies contains multiple major versions with different feature sets,
krates
0.16.1 produces an internal error.To Reproduce
Cargo.toml
:Rust code (reduced from
cargo_about::get_all_crates
):Additional context I encountered this problem while attempting to make
cargo-about
usekrates
0.16 to get the fix for #64. However, the bug also exists inkrates@0.15.3
but notkrates@0.15.1
— but this may be just because the panic was only introduced by #63.