about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-31 13:53:33 -0700
committerGitHub <noreply@github.com>2016-08-31 13:53:33 -0700
commitc75fd78de3f01885d6b39a6ec532e68d183e1121 (patch)
treeb1200a3729d07e250ab08a8348cf79c0db6d7194
parent7a187c39c79e21cd61d1688d449bdd52d7510281 (diff)
parentd4ca5613a043e5f2b0ac8b4d7770be1f7f6e2349 (diff)
Rollup merge of #35773 - EugeneGonzalez:master, r=jonathandturner
Change E0259 to the new error format

Fixes #35514 as part of #35233.

Sorry about creating a new PR I was having a lot of troubles squashing the commit because I didn't properly branch the new feature.

r? @GuillaumeGomez
-rw-r--r--src/librustc_resolve/lib.rs6
-rw-r--r--src/test/compile-fail/E0259.rs6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 3dd6485f15f..54efc4ae30a 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -3349,7 +3349,11 @@ impl<'a> Resolver<'a> {
         };
 
         let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
-            (true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
+            (true, true) => {
+                let mut e = struct_span_err!(self.session, span, E0259, "{}", msg);
+                e.span_label(span, &format!("`{}` was already imported", name));
+                e
+            },
             (true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
                 let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
                 e.span_label(span, &"already imported");
diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs
index 6b7e8613859..d3e876e2527 100644
--- a/src/test/compile-fail/E0259.rs
+++ b/src/test/compile-fail/E0259.rs
@@ -9,6 +9,10 @@
 // except according to those terms.
 
 extern crate collections;
-extern crate libc as collections; //~ ERROR E0259
+//~^ NOTE previous import of `collections` here
+
+extern crate libc as collections;
+//~^ ERROR E0259
+//~| NOTE `collections` was already imported
 
 fn main() {}