mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 22:24:14 +00:00
Skip problematic cyclic dev-dependencies
This commit is contained in:
parent
f07489ada9
commit
76fb73a99e
1 changed files with 18 additions and 0 deletions
|
@ -1091,6 +1091,24 @@ fn cargo_to_crate_graph(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the dependency is a dev-dependency with both crates being member libraries of
|
||||||
|
// the workspace we discard the edge. The reason can be read up on in
|
||||||
|
// https://github.com/rust-lang/rust-analyzer/issues/14167
|
||||||
|
// but in short, such an edge usually causes some form of cycle in the crate graph
|
||||||
|
// wrt to unit tests. Something we cannot reasonable support.
|
||||||
|
if dep.kind == DepKind::Dev
|
||||||
|
&& matches!(kind, TargetKind::Lib { .. })
|
||||||
|
&& cargo[dep.pkg].is_member
|
||||||
|
&& cargo[pkg].is_member
|
||||||
|
{
|
||||||
|
tracing::warn!(
|
||||||
|
"Discarding dev-dependency edge from library target `{}` to library target `{}` to prevent potential cycles",
|
||||||
|
cargo[dep.pkg].name,
|
||||||
|
cargo[pkg].name
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
add_dep(crate_graph, from, name.clone(), to)
|
add_dep(crate_graph, from, name.clone(), to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue