File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1091,6 +1091,24 @@ fn cargo_to_crate_graph(
10911091 continue ;
10921092 }
10931093
1094+ // If the dependency is a dev-dependency with both crates being member libraries of
1095+ // the workspace we discard the edge. The reason can be read up on in
1096+ // https://github.com/rust-lang/rust-analyzer/issues/14167
1097+ // but in short, such an edge usually causes some form of cycle in the crate graph
1098+ // wrt to unit tests. Something we cannot reasonable support.
1099+ if dep. kind == DepKind :: Dev
1100+ && matches ! ( kind, TargetKind :: Lib { .. } )
1101+ && cargo[ dep. pkg ] . is_member
1102+ && cargo[ pkg] . is_member
1103+ {
1104+ tracing:: warn!(
1105+ "Discarding dev-dependency edge from library target `{}` to library target `{}` to prevent potential cycles" ,
1106+ cargo[ dep. pkg] . name,
1107+ cargo[ pkg] . name
1108+ ) ;
1109+ continue ;
1110+ }
1111+
10941112 add_dep ( crate_graph, from, name. clone ( ) , to)
10951113 }
10961114 }
You can’t perform that action at this time.
0 commit comments