diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 7f6614a959c89..aa74fb2e02fa0 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -718,10 +718,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let lifetime_j = &lifetimes[j]; if lifetime_i.lifetime.name == lifetime_j.lifetime.name { - span_err!(self.sess, lifetime_j.lifetime.span, E0263, - "lifetime name `{}` declared twice in \ - the same scope", - lifetime_j.lifetime.name); + struct_span_err!(self.sess, lifetime_j.lifetime.span, E0263, + "lifetime name `{}` declared twice in the same scope", + lifetime_j.lifetime.name) + .span_label(lifetime_j.lifetime.span, + &format!("declared twice")) + .span_label(lifetime_i.lifetime.span, + &format!("previous declaration here")) + .emit(); } } diff --git a/src/test/compile-fail/E0263.rs b/src/test/compile-fail/E0263.rs index 09f654c368c62..11a8ff443a845 100644 --- a/src/test/compile-fail/E0263.rs +++ b/src/test/compile-fail/E0263.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } //~ ERROR E0263 +fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { + //~^ ERROR E0263 + //~| NOTE declared twice + //~| NOTE previous declaration here +} fn main() {}