Skip to content

Commit a2b5fbb

Browse files
Merge #3674
3674: Use target-name for crate-name in Crate graph building r=matklad a=edwin0cheng Fix #3667 Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2 parents 50c6a31 + d62dd63 commit a2b5fbb

File tree

1 file changed

+3
-3
lines changed
  • crates/ra_project_model/src

1 file changed

+3
-3
lines changed

crates/ra_project_model/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl ProjectWorkspace {
336336
extern_source,
337337
);
338338
if cargo[tgt].kind == TargetKind::Lib {
339-
lib_tgt = Some(crate_id);
339+
lib_tgt = Some((crate_id, cargo[tgt].name.clone()));
340340
pkg_to_lib_crate.insert(pkg, crate_id);
341341
}
342342
if cargo[tgt].is_proc_macro {
@@ -363,15 +363,15 @@ impl ProjectWorkspace {
363363

364364
// Set deps to the core, std and to the lib target of the current package
365365
for &from in pkg_crates.get(&pkg).into_iter().flatten() {
366-
if let Some(to) = lib_tgt {
366+
if let Some((to, name)) = lib_tgt.clone() {
367367
if to != from
368368
&& crate_graph
369369
.add_dep(
370370
from,
371371
// For root projects with dashes in their name,
372372
// cargo metadata does not do any normalization,
373373
// so we do it ourselves currently
374-
CrateName::normalize_dashes(&cargo[pkg].name),
374+
CrateName::normalize_dashes(&name),
375375
to,
376376
)
377377
.is_err()

0 commit comments

Comments
 (0)