-> CargoResult<()> {
// See if we visited ourselves
if !visited.insert(id) {
- bail!("cyclic package dependency: package `{}` depends on itself. Cycle (not in order): {:#?}",
- id, visited);
+ let mut cycle = String::new();
+ for package_id in visited.iter() {
+ cycle += &format!("\n {}", package_id);
+ }
+ bail!("cyclic package dependency: package `{}` depends on itself. Cycle (not in order):{}",
+ id, cycle);
}
// If we've already checked this node no need to recurse again as we'll
assert_that(p.cargo("build"),
execs().with_status(101)
.with_stderr_contains("\
-[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself[..]"));
+[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself. Cycle (not in order):
+ test v0.0.0 ([..][/]foo)
+"));
}
#[test]
execs().with_status(101)
.with_stderr_contains("\
[ERROR] cyclic package dependency: package `a v0.0.1 ([..]")
- .with_stderr_contains("[..]depends on itself[..]"));
+ .with_stderr_contains("[..]depends on itself[..]")
+ .with_stderr_contains(" foo v0.0.1 ([..][/]foo)")
+ .with_stderr_contains(" a v0.0.1 ([..][/]a)"));
+
}
#[test]