File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,15 @@ fn cargo_to_crate_graph(
574
574
has_private |= cargo[ pkg] . metadata . rustc_private ;
575
575
let mut lib_tgt = None ;
576
576
for & tgt in cargo[ pkg] . targets . iter ( ) {
577
+ if cargo[ tgt] . kind != TargetKind :: Lib && !cargo[ pkg] . is_member {
578
+ // For non-workspace-members, Cargo does not resolve dev-dependencies, so we don't
579
+ // add any targets except the library target, since those will not work correctly if
580
+ // they use dev-dependencies.
581
+ // In fact, they can break quite badly if multiple client workspaces get merged:
582
+ // https://github.com/rust-analyzer/rust-analyzer/issues/11300
583
+ continue ;
584
+ }
585
+
577
586
if let Some ( file_id) = load ( & cargo[ tgt] . root ) {
578
587
let crate_id = add_target_crate_root (
579
588
& mut crate_graph,
You can’t perform that action at this time.
0 commit comments