-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-dependency-resolutionArea: dependency resolution and the resolverArea: dependency resolution and the resolverC-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
Problem
A cyclical dev-dependency with a missing feature causes a panic:
thread 'main' panicked at src/cargo/util/graph.rs:149:20:
the only path was a cycle, no dependency graph has this shape
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::option::expect_failed
3: <cargo::util::graph::Graph<cargo::core::package_id::PackageId, im_rc::hash::set::HashSet<cargo::core::dependency::Dependency>>>::path_to::<<cargo::util::graph::Graph<cargo::core::package_id::PackageId, im_rc::hash::set::HashSet<cargo::core::dependency::Dependency>>>::path_to_bottom::{closure#0}, core::iter::adapters::flatten::FlatMap<core::option::IntoIter<&im_rc::ord::map::OrdMap<cargo::core::package_id::PackageId, im_rc::hash::set::HashSet<cargo::core::dependency::Dependency>>>, im_rc::ord::map::Iter<cargo::core::package_id::PackageId, im_rc::hash::set::HashSet<cargo::core::dependency::Dependency>>, <cargo::util::graph::Graph<cargo::core::package_id::PackageId, im_rc::hash::set::HashSet<cargo::core::dependency::Dependency>>>::edges::{closure#0}>>
4: cargo::core::resolver::errors::describe_path_in_context
5: cargo::core::resolver::errors::activation_error
6: cargo::core::resolver::activate_deps_loop
7: cargo::core::resolver::resolve
8: cargo::ops::resolve::resolve_with_previous
9: cargo::ops::cargo_generate_lockfile::generate_lockfile
10: cargo::commands::generate_lockfile::exec
11: cargo::cli::main
12: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Steps
A test using cargo's test infrastructure:
#[cargo_test]
fn cyclical_dep_with_missing_feature() {
// Checks for error handling when a cyclical dev-dependency specify a
// feature that doesn't exist.
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[dev-dependencies]
foo = { path = ".", features = ["missing"] }
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("check")
.with_status(101)
.with_stderr("ENTER CORRECT ERROR HERE")
.run();
}
Possible Solution(s)
I'm not sure.
Notes
No response
Version
cargo 1.75.0-nightly (b4d18d4bd 2023-10-31)
release: 1.75.0-nightly
commit-hash: b4d18d4bd3db6d872892f6c87c51a02999b80802
commit-date: 2023-10-31
host: aarch64-apple-darwin
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.1.2 (sys:0.4.68+curl-8.4.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1u 30 May 2023
os: Mac OS 14.0.0 [64-bit]
Metadata
Metadata
Assignees
Labels
A-dependency-resolutionArea: dependency resolution and the resolverArea: dependency resolution and the resolverC-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.