about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-11 06:34:01 -0700
committerGitHub <noreply@github.com>2016-08-11 06:34:01 -0700
commitaaed538b24191c2523b5221ee4d491a51d111e04 (patch)
treed9a7db2d93845ca79c0b5e6715f3b23e02dc4f57
parenta5408a54155fb3587ae52fc913c496a2119f2abb (diff)
parent46265a0809d85eeb5e9b3316996a789e094e05b7 (diff)
downloadrust-aaed538b24191c2523b5221ee4d491a51d111e04.tar.gz
rust-aaed538b24191c2523b5221ee4d491a51d111e04.zip
Rollup merge of #35557 - Limeth:master, r=jonathandturner
E0263 updated to new format.

Fixes #35518. Part of #35233.
r? @jonathandturner
-rw-r--r--src/librustc/middle/resolve_lifetime.rs12
-rw-r--r--src/test/compile-fail/E0263.rs6
2 files changed, 13 insertions, 5 deletions
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 7f6614a959c..aa74fb2e02f 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 09f654c368c..11a8ff443a8 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() {}