Skip to content

Commit

Permalink
Print correct crate name
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 8, 2015
1 parent 00e7005 commit c65d338
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/librustc/middle/infer/error_reporting.rs
Expand Up @@ -511,9 +511,11 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
// We compare strings because PathMod and PathName can be different
// for imported and non-imported crates
if exp_path == found_path {
let crate_name = self.tcx.sess.cstore
.get_crate_data(did1.krate).name();
self.tcx.sess.span_note(sp, &format!("Perhaps two different versions \
of crate `{}` are being used?",
exp_path[0]));
crate_name));
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/type-mismatch-same-crate-name.rs
Expand Up @@ -25,9 +25,9 @@ fn main() {
extern crate crate_a1 as a;
a::try_foo(foo2); //~ ERROR mismatched types
//~^ HELP run
//~^^ NOTE Perhaps two different versions of crate `main`
//~^^ NOTE Perhaps two different versions of crate `crate_a1`
a::try_bar(bar2); //~ ERROR mismatched types
//~^ HELP run
//~^^ NOTE Perhaps two different versions of crate `main`
//~^^ NOTE Perhaps two different versions of crate `crate_a1`
}
}

0 comments on commit c65d338

Please sign in to comment.