about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-12-02 11:39:42 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-12-02 11:39:42 +0900
commitcdcce115043a19b2bbc154e56b59fa2f5017bbbc (patch)
tree25404241f9fe5026d3a7fc624216edd794576a5d
parent6645da366eed0c61258a04265bea513e94df7ea6 (diff)
downloadrust-cdcce115043a19b2bbc154e56b59fa2f5017bbbc.tar.gz
rust-cdcce115043a19b2bbc154e56b59fa2f5017bbbc.zip
Tweak diagnostics on shadowing lifetimes/labels
-rw-r--r--compiler/rustc_resolve/src/late/lifetimes.rs2
-rw-r--r--src/test/ui/error-codes/E0496.stderr2
-rw-r--r--src/test/ui/generic-associated-types/shadowing.stderr4
-rw-r--r--src/test/ui/hygiene/hygienic-labels-in-let.stderr56
-rw-r--r--src/test/ui/hygiene/hygienic-labels.stderr56
-rw-r--r--src/test/ui/in-band-lifetimes/shadow.stderr4
-rw-r--r--src/test/ui/lint/unused_labels.stderr2
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels-2.stderr16
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels.stderr16
-rw-r--r--src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr24
-rw-r--r--src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr2
-rw-r--r--src/test/ui/macros/macro-lifetime-used-with-labels.stderr2
-rw-r--r--src/test/ui/shadowed/shadowed-lifetime.stderr4
13 files changed, 95 insertions, 95 deletions
diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs
index 91edbebc05f..69f28045bb5 100644
--- a/compiler/rustc_resolve/src/late/lifetimes.rs
+++ b/compiler/rustc_resolve/src/late/lifetimes.rs
@@ -1098,7 +1098,7 @@ fn signal_shadowing_problem(tcx: TyCtxt<'_>, name: Symbol, orig: Original, shado
         )
     };
     err.span_label(orig.span, "first declared here");
-    err.span_label(shadower.span, format!("lifetime {} already in scope", name));
+    err.span_label(shadower.span, format!("{} `{}` already in scope", orig.kind.desc(), name));
     err.emit();
 }
 
diff --git a/src/test/ui/error-codes/E0496.stderr b/src/test/ui/error-codes/E0496.stderr
index b0294eef04e..80ca2b1fbdb 100644
--- a/src/test/ui/error-codes/E0496.stderr
+++ b/src/test/ui/error-codes/E0496.stderr
@@ -4,7 +4,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop
 LL | impl<'a> Foo<'a> {
    |      -- first declared here
 LL |     fn f<'a>(x: &'a i32) {
-   |          ^^ lifetime 'a already in scope
+   |          ^^ lifetime `'a` already in scope
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr
index d51c29080a0..95cebbb8681 100644
--- a/src/test/ui/generic-associated-types/shadowing.stderr
+++ b/src/test/ui/generic-associated-types/shadowing.stderr
@@ -20,7 +20,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop
 LL | trait Shadow<'a> {
    |              -- first declared here
 LL |     type Bar<'a>;
-   |              ^^ lifetime 'a already in scope
+   |              ^^ lifetime `'a` already in scope
 
 error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
   --> $DIR/shadowing.rs:14:14
@@ -28,7 +28,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop
 LL | impl<'a> NoShadow<'a> for &'a u32 {
    |      -- first declared here
 LL |     type Bar<'a> = i32;
-   |              ^^ lifetime 'a already in scope
+   |              ^^ lifetime `'a` already in scope
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr
index 3ff45a8a566..9e7811b8072 100644
--- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr
+++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr
@@ -2,7 +2,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:16:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: loop {
    |         -- first declared here
@@ -19,7 +19,7 @@ LL |         'x: loop {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:64:9
@@ -28,13 +28,13 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:16:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: loop {
    |         -- first declared here
@@ -51,7 +51,7 @@ LL |         'x: loop { $e }
    |         ^^
    |         |
    |         first declared here
-   |         lifetime 'x already in scope
+   |         label `'x` already in scope
 ...
 LL |             loop_x!(break 'x);
    |             ------------------ in this macro invocation
@@ -62,7 +62,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:16:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
@@ -79,7 +79,7 @@ LL |         'x: loop {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:76:9
@@ -88,7 +88,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:76:9
@@ -97,7 +97,7 @@ LL |         'x: for _ in 0..1 {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:76:9
@@ -106,13 +106,13 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: loop {
    |         -- first declared here
@@ -129,7 +129,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
@@ -140,7 +140,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
@@ -157,7 +157,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
@@ -168,7 +168,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
@@ -185,7 +185,7 @@ LL |         'x: loop {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -194,7 +194,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -203,7 +203,7 @@ LL |         'x: for _ in 0..1 {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -212,7 +212,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -221,7 +221,7 @@ LL |         'x: for _ in 0..1 {
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -230,13 +230,13 @@ LL |         'x: while 1 + 1 == 2 { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 {
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: loop {
    |         -- first declared here
@@ -253,7 +253,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
@@ -264,7 +264,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
@@ -281,7 +281,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
@@ -292,7 +292,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
@@ -309,7 +309,7 @@ LL |         'x: while 1 + 1 == 2 { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
@@ -320,7 +320,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: for _ in 0..1 {
    |         -- first declared here
diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr
index 25098c25c82..275478d292d 100644
--- a/src/test/ui/hygiene/hygienic-labels.stderr
+++ b/src/test/ui/hygiene/hygienic-labels.stderr
@@ -2,7 +2,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:13:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: for _ in 0..1 {
    |     -- first declared here
@@ -19,7 +19,7 @@ LL |     'x: for _ in 0..1 {
    |     -- first declared here
 ...
 LL |     'x: loop {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:54:5
@@ -28,13 +28,13 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |     'x: loop {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:13:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: for _ in 0..1 {
    |     -- first declared here
@@ -51,7 +51,7 @@ LL |         'x: loop { $e }
    |         ^^
    |         |
    |         first declared here
-   |         lifetime 'x already in scope
+   |         label `'x` already in scope
 ...
 LL |         loop_x!(break 'x);
    |         ------------------ in this macro invocation
@@ -62,7 +62,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:13:9
    |
 LL |         'x: loop { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: loop {
    |     -- first declared here
@@ -79,7 +79,7 @@ LL |     'x: for _ in 0..1 {
    |     -- first declared here
 ...
 LL |     'x: while 1 + 1 == 2 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:63:5
@@ -88,7 +88,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |     'x: while 1 + 1 == 2 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:63:5
@@ -97,7 +97,7 @@ LL |     'x: loop {
    |     -- first declared here
 ...
 LL |     'x: while 1 + 1 == 2 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:63:5
@@ -106,13 +106,13 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |     'x: while 1 + 1 == 2 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: for _ in 0..1 {
    |     -- first declared here
@@ -129,7 +129,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
@@ -140,7 +140,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: loop {
    |     -- first declared here
@@ -157,7 +157,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
@@ -168,7 +168,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
    |
 LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: while 1 + 1 == 2 {
    |     -- first declared here
@@ -185,7 +185,7 @@ LL |     'x: for _ in 0..1 {
    |     -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -194,7 +194,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -203,7 +203,7 @@ LL |     'x: loop {
    |     -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -212,7 +212,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -221,7 +221,7 @@ LL |     'x: while 1 + 1 == 2 {
    |     -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -230,13 +230,13 @@ LL |         'x: while 1 + 1 == 2 { $e }
    |         -- first declared here
 ...
 LL |     'x: for _ in 0..1 {
-   |     ^^ lifetime 'x already in scope
+   |     ^^ label `'x` already in scope
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: for _ in 0..1 {
    |     -- first declared here
@@ -253,7 +253,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
@@ -264,7 +264,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: loop {
    |     -- first declared here
@@ -281,7 +281,7 @@ LL |         'x: loop { $e }
    |         -- first declared here
 ...
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
@@ -292,7 +292,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: while 1 + 1 == 2 {
    |     -- first declared here
@@ -306,7 +306,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |         'x: while 1 + 1 == 2 { $e }
    |         -- first declared here
@@ -320,7 +320,7 @@ warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
    |
 LL |         'x: for _ in 0..1 { $e }
-   |         ^^ lifetime 'x already in scope
+   |         ^^ label `'x` already in scope
 ...
 LL |     'x: for _ in 0..1 {
    |     -- first declared here
diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/in-band-lifetimes/shadow.stderr
index a0a15d3aa88..c7a6f3ac3ad 100644
--- a/src/test/ui/in-band-lifetimes/shadow.stderr
+++ b/src/test/ui/in-band-lifetimes/shadow.stderr
@@ -4,7 +4,7 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scop
 LL | impl Foo<&'s u8> {
    |           -- first declared here
 LL |     fn bar<'s>(&self, x: &'s u8) {}
-   |            ^^ lifetime 's already in scope
+   |            ^^ lifetime `'s` already in scope
 
 error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope
   --> $DIR/shadow.rs:8:19
@@ -13,7 +13,7 @@ LL | impl Foo<&'s u8> {
    |           -- first declared here
 LL |     fn bar<'s>(&self, x: &'s u8) {}
 LL |     fn baz(x: for<'s> fn(&'s u32)) {}
-   |                   ^^ lifetime 's already in scope
+   |                   ^^ lifetime `'s` already in scope
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr
index 443faebd0f8..4bb1a437d24 100644
--- a/src/test/ui/lint/unused_labels.stderr
+++ b/src/test/ui/lint/unused_labels.stderr
@@ -59,7 +59,7 @@ LL |     'many_used_shadowed: for _ in 0..10 {
    |     ------------------- first declared here
 LL |
 LL |         'many_used_shadowed: for _ in 0..10 {
-   |         ^^^^^^^^^^^^^^^^^^^ lifetime 'many_used_shadowed already in scope
+   |         ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope
 
 warning: 9 warnings emitted
 
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
index 3c8e2938d41..724c36e5203 100644
--- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
+++ b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
@@ -4,7 +4,7 @@ warning: label name `'fl` shadows a label name that is already in scope
 LL |     { 'fl: for _ in 0..10 { break; } }
    |       --- first declared here
 LL |     { 'fl: loop { break; } }
-   |       ^^^ lifetime 'fl already in scope
+   |       ^^^ label `'fl` already in scope
 
 warning: label name `'lf` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:16:7
@@ -12,7 +12,7 @@ warning: label name `'lf` shadows a label name that is already in scope
 LL |     { 'lf: loop { break; } }
    |       --- first declared here
 LL |     { 'lf: for _ in 0..10 { break; } }
-   |       ^^^ lifetime 'lf already in scope
+   |       ^^^ label `'lf` already in scope
 
 warning: label name `'wl` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:18:7
@@ -20,7 +20,7 @@ warning: label name `'wl` shadows a label name that is already in scope
 LL |     { 'wl: while 2 > 1 { break; } }
    |       --- first declared here
 LL |     { 'wl: loop { break; } }
-   |       ^^^ lifetime 'wl already in scope
+   |       ^^^ label `'wl` already in scope
 
 warning: label name `'lw` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:20:7
@@ -28,7 +28,7 @@ warning: label name `'lw` shadows a label name that is already in scope
 LL |     { 'lw: loop { break; } }
    |       --- first declared here
 LL |     { 'lw: while 2 > 1 { break; } }
-   |       ^^^ lifetime 'lw already in scope
+   |       ^^^ label `'lw` already in scope
 
 warning: label name `'fw` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:22:7
@@ -36,7 +36,7 @@ warning: label name `'fw` shadows a label name that is already in scope
 LL |     { 'fw: for _ in 0..10 { break; } }
    |       --- first declared here
 LL |     { 'fw: while 2 > 1 { break; } }
-   |       ^^^ lifetime 'fw already in scope
+   |       ^^^ label `'fw` already in scope
 
 warning: label name `'wf` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:24:7
@@ -44,7 +44,7 @@ warning: label name `'wf` shadows a label name that is already in scope
 LL |     { 'wf: while 2 > 1 { break; } }
    |       --- first declared here
 LL |     { 'wf: for _ in 0..10 { break; } }
-   |       ^^^ lifetime 'wf already in scope
+   |       ^^^ label `'wf` already in scope
 
 warning: label name `'tl` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:26:7
@@ -52,7 +52,7 @@ warning: label name `'tl` shadows a label name that is already in scope
 LL |     { 'tl: while let Some(_) = None::<i32> { break; } }
    |       --- first declared here
 LL |     { 'tl: loop { break; } }
-   |       ^^^ lifetime 'tl already in scope
+   |       ^^^ label `'tl` already in scope
 
 warning: label name `'lt` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels-2.rs:28:7
@@ -60,7 +60,7 @@ warning: label name `'lt` shadows a label name that is already in scope
 LL |     { 'lt: loop { break; } }
    |       --- first declared here
 LL |     { 'lt: while let Some(_) = None::<i32> { break; } }
-   |       ^^^ lifetime 'lt already in scope
+   |       ^^^ label `'lt` already in scope
 
 warning: 8 warnings emitted
 
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr
index 5a3e5158fed..2d112812017 100644
--- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr
+++ b/src/test/ui/loops/loops-reject-duplicate-labels.stderr
@@ -4,7 +4,7 @@ warning: label name `'fl` shadows a label name that is already in scope
 LL |     'fl: for _ in 0..10 { break; }
    |     --- first declared here
 LL |     'fl: loop { break; }
-   |     ^^^ lifetime 'fl already in scope
+   |     ^^^ label `'fl` already in scope
 
 warning: label name `'lf` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:14:5
@@ -12,7 +12,7 @@ warning: label name `'lf` shadows a label name that is already in scope
 LL |     'lf: loop { break; }
    |     --- first declared here
 LL |     'lf: for _ in 0..10 { break; }
-   |     ^^^ lifetime 'lf already in scope
+   |     ^^^ label `'lf` already in scope
 
 warning: label name `'wl` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:16:5
@@ -20,7 +20,7 @@ warning: label name `'wl` shadows a label name that is already in scope
 LL |     'wl: while 2 > 1 { break; }
    |     --- first declared here
 LL |     'wl: loop { break; }
-   |     ^^^ lifetime 'wl already in scope
+   |     ^^^ label `'wl` already in scope
 
 warning: label name `'lw` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:18:5
@@ -28,7 +28,7 @@ warning: label name `'lw` shadows a label name that is already in scope
 LL |     'lw: loop { break; }
    |     --- first declared here
 LL |     'lw: while 2 > 1 { break; }
-   |     ^^^ lifetime 'lw already in scope
+   |     ^^^ label `'lw` already in scope
 
 warning: label name `'fw` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:20:5
@@ -36,7 +36,7 @@ warning: label name `'fw` shadows a label name that is already in scope
 LL |     'fw: for _ in 0..10 { break; }
    |     --- first declared here
 LL |     'fw: while 2 > 1 { break; }
-   |     ^^^ lifetime 'fw already in scope
+   |     ^^^ label `'fw` already in scope
 
 warning: label name `'wf` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:22:5
@@ -44,7 +44,7 @@ warning: label name `'wf` shadows a label name that is already in scope
 LL |     'wf: while 2 > 1 { break; }
    |     --- first declared here
 LL |     'wf: for _ in 0..10 { break; }
-   |     ^^^ lifetime 'wf already in scope
+   |     ^^^ label `'wf` already in scope
 
 warning: label name `'tl` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:24:5
@@ -52,7 +52,7 @@ warning: label name `'tl` shadows a label name that is already in scope
 LL |     'tl: while let Some(_) = None::<i32> { break; }
    |     --- first declared here
 LL |     'tl: loop { break; }
-   |     ^^^ lifetime 'tl already in scope
+   |     ^^^ label `'tl` already in scope
 
 warning: label name `'lt` shadows a label name that is already in scope
   --> $DIR/loops-reject-duplicate-labels.rs:26:5
@@ -60,7 +60,7 @@ warning: label name `'lt` shadows a label name that is already in scope
 LL |     'lt: loop { break; }
    |     --- first declared here
 LL |     'lt: while let Some(_) = None::<i32> { break; }
-   |     ^^^ lifetime 'lt already in scope
+   |     ^^^ label `'lt` already in scope
 
 warning: 8 warnings emitted
 
diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
index c27e61190bb..0d96c0b3a35 100644
--- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
+++ b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
@@ -4,7 +4,7 @@ warning: label name `'a` shadows a lifetime name that is already in scope
 LL |     fn foo<'a>() {
    |            -- first declared here
 LL |         'a: loop { break 'a; }
-   |         ^^ lifetime 'a already in scope
+   |         ^^ lifetime `'a` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:35:13
@@ -13,7 +13,7 @@ LL |     impl<'bad, 'c> Struct<'bad, 'c> {
    |          ---- first declared here
 LL |         fn meth_bad(&self) {
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:42:13
@@ -22,7 +22,7 @@ LL |     impl<'b, 'bad> Struct<'b, 'bad> {
    |              ---- first declared here
 LL |         fn meth_bad2(&self) {
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:49:13
@@ -30,7 +30,7 @@ warning: label name `'bad` shadows a lifetime name that is already in scope
 LL |         fn meth_bad3<'bad>(x: &'bad i8) {
    |                      ---- first declared here
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:54:13
@@ -38,7 +38,7 @@ warning: label name `'bad` shadows a lifetime name that is already in scope
 LL |         fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) {
    |                         ---- first declared here
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:61:13
@@ -47,7 +47,7 @@ LL |     impl <'bad, 'e> Enum<'bad, 'e> {
    |           ---- first declared here
 LL |         fn meth_bad(&self) {
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:67:13
@@ -56,7 +56,7 @@ LL |     impl <'d, 'bad> Enum<'d, 'bad> {
    |               ---- first declared here
 LL |         fn meth_bad2(&self) {
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:73:13
@@ -64,7 +64,7 @@ warning: label name `'bad` shadows a lifetime name that is already in scope
 LL |         fn meth_bad3<'bad>(x: &'bad i8) {
    |                      ---- first declared here
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:78:13
@@ -72,7 +72,7 @@ warning: label name `'bad` shadows a lifetime name that is already in scope
 LL |         fn meth_bad4<'a,'bad>(x: &'bad i8) {
    |                         ---- first declared here
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13
@@ -81,7 +81,7 @@ LL |     trait HasDefaultMethod1<'bad> {
    |                             ---- first declared here
 ...
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:94:13
@@ -90,7 +90,7 @@ LL |     trait HasDefaultMethod2<'a,'bad> {
    |                                ---- first declared here
 LL |         fn meth_bad(&self) {
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: label name `'bad` shadows a lifetime name that is already in scope
   --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:100:13
@@ -98,7 +98,7 @@ warning: label name `'bad` shadows a lifetime name that is already in scope
 LL |         fn meth_bad<'bad>(&self) {
    |                     ---- first declared here
 LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime 'bad already in scope
+   |             ^^^^ lifetime `'bad` already in scope
 
 warning: 12 warnings emitted
 
diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
index b31ef273fc6..dcee1a80090 100644
--- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
+++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
@@ -4,7 +4,7 @@ warning: lifetime name `'a` shadows a label name that is already in scope
 LL |     'a: loop {
    |     -- first declared here
 LL |         let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>;
-   |                                                       ^^ lifetime 'a already in scope
+   |                                                       ^^ label `'a` already in scope
 
 warning: 1 warning emitted
 
diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
index 98ee85d908d..68f885e9e45 100644
--- a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
+++ b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
@@ -2,7 +2,7 @@ warning: label name `'b` shadows a label name that is already in scope
   --> $DIR/macro-lifetime-used-with-labels.rs:21:9
    |
 LL |         'b: loop {
-   |         ^^ lifetime 'b already in scope
+   |         ^^ label `'b` already in scope
 ...
 LL |     'b: loop {
    |     -- first declared here
diff --git a/src/test/ui/shadowed/shadowed-lifetime.stderr b/src/test/ui/shadowed/shadowed-lifetime.stderr
index 5ea3d926430..68cc505d36d 100644
--- a/src/test/ui/shadowed/shadowed-lifetime.stderr
+++ b/src/test/ui/shadowed/shadowed-lifetime.stderr
@@ -4,7 +4,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop
 LL | impl<'a> Foo<'a> {
    |      -- first declared here
 LL |     fn shadow_in_method<'a>(&'a self) -> &'a isize {
-   |                         ^^ lifetime 'a already in scope
+   |                         ^^ lifetime `'a` already in scope
 
 error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope
   --> $DIR/shadowed-lifetime.rs:12:20
@@ -12,7 +12,7 @@ error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scop
 LL |     fn shadow_in_type<'b>(&'b self) -> &'b isize {
    |                       -- first declared here
 LL |         let x: for<'b> fn(&'b isize) = panic!();
-   |                    ^^ lifetime 'b already in scope
+   |                    ^^ lifetime `'b` already in scope
 
 error: aborting due to 2 previous errors