From d4ca5613a043e5f2b0ac8b4d7770be1f7f6e2349 Mon Sep 17 00:00:00 2001 From: Eugene R Gonzalez Date: Wed, 17 Aug 2016 21:02:53 -0400 Subject: [PATCH] Change E0259 to the new error format Fixed E0259 unit test Added name of conflict to E0259's note --- src/librustc_resolve/lib.rs | 6 +++++- src/test/compile-fail/E0259.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index d90a932a63d86..51f093054650d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3366,7 +3366,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 6b7e86138594b..d3e876e2527fe 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() {}