about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/middle/infer/error_reporting.rs4
-rw-r--r--src/test/compile-fail/type-mismatch-same-crate-name.rs4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index 363af87b70b..7ec39ac8515 100644
--- a/src/librustc/middle/infer/error_reporting.rs
+++ b/src/librustc/middle/infer/error_reporting.rs
@@ -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));
                 }
             }
         };
diff --git a/src/test/compile-fail/type-mismatch-same-crate-name.rs b/src/test/compile-fail/type-mismatch-same-crate-name.rs
index 69ef31e90e4..014fa35c309 100644
--- a/src/test/compile-fail/type-mismatch-same-crate-name.rs
+++ b/src/test/compile-fail/type-mismatch-same-crate-name.rs
@@ -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`
     }
 }