3674: Use target-name for crate-name in Crate graph building r=matklad a=edwin0cheng

Fix 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot] 2020-03-21 17:21:53 +00:00 committed by GitHub
commit a2b5fbb076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -336,7 +336,7 @@ impl ProjectWorkspace {
extern_source,
);
if cargo[tgt].kind == TargetKind::Lib {
lib_tgt = Some(crate_id);
lib_tgt = Some((crate_id, cargo[tgt].name.clone()));
pkg_to_lib_crate.insert(pkg, crate_id);
}
if cargo[tgt].is_proc_macro {
@ -363,7 +363,7 @@ impl ProjectWorkspace {
// Set deps to the core, std and to the lib target of the current package
for &from in pkg_crates.get(&pkg).into_iter().flatten() {
if let Some(to) = lib_tgt {
if let Some((to, name)) = lib_tgt.clone() {
if to != from
&& crate_graph
.add_dep(
@ -371,7 +371,7 @@ impl ProjectWorkspace {
// For root projects with dashes in their name,
// cargo metadata does not do any normalization,
// so we do it ourselves currently
CrateName::normalize_dashes(&cargo[pkg].name),
CrateName::normalize_dashes(&name),
to,
)
.is_err()