about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-03 07:27:09 +0000
committerbors <bors@rust-lang.org>2022-06-03 07:27:09 +0000
commit3a90bedb332d7d7eabfc1e98a1e3d96898579e1d (patch)
treed18addb5c4a51f1ba4dafe54290099ece23766b2 /src/test
parentf5507aa881921f1cef42851ae976317ddb0c09ae (diff)
parent2aa9c703ce9ce9c69d466481b2fda3268db64f3e (diff)
downloadrust-3a90bedb332d7d7eabfc1e98a1e3d96898579e1d.tar.gz
rust-3a90bedb332d7d7eabfc1e98a1e3d96898579e1d.zip
Auto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkov
Remove label/lifetime shadowing warnings

This PR removes some pre-1.0 shadowing warnings for labels and lifetimes.

The current behaviour of the compiler is to warn
* labels that shadow unrelated labels in the same function --> removed
```rust
'a: loop {}
'a: loop {} // STOP WARNING
```

* labels that shadow enclosing labels --> kept, but only if shadowing is hygienic
```rust
'a: loop {
  'a: loop {} // KEEP WARNING
}
```

* labels that shadow lifetime --> removed
```rust
fn foo<'a>() {
  'a: loop {} // STOP WARNING
}
```

* lifetimes that shadow labels --> removed
```rust
'a: loop {
  let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // STOP WARNING
}
```

* lifetimes that shadow lifetimes --> kept
```rust
fn foo<'a>() {
  let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // KEEP WARNING
}
```

Closes https://github.com/rust-lang/rust/issues/31745.

-----

From `@petrochenkov` in https://github.com/rust-lang/rust/pull/95781#issuecomment-1105199014
> I think we should remove these silly checks entirely.
> They were introduced long time ago in case some new language features appear and require this space.
> Now we have another mechanism for such language changes - editions, and if "lifetimes in expressions" or something like that needs to be introduced it could be introduced as an edition change.
> However, there was no plans to introduce anything like for years, so it's unlikely that even the edition mechanism will be necessary.

r? rust-lang/lang
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/error-codes/E0263.rs2
-rw-r--r--src/test/ui/error-codes/E0263.stderr8
-rw-r--r--src/test/ui/for-loop-while/label_break_value.rs6
-rw-r--r--src/test/ui/for-loop-while/label_break_value.stderr28
-rw-r--r--src/test/ui/for-loop-while/label_break_value_invalid.rs5
-rw-r--r--src/test/ui/for-loop-while/label_break_value_invalid.stderr63
-rw-r--r--src/test/ui/generic-associated-types/shadowing.stderr32
-rw-r--r--src/test/ui/hygiene/duplicate_lifetimes.rs4
-rw-r--r--src/test/ui/hygiene/duplicate_lifetimes.stderr14
-rw-r--r--src/test/ui/hygiene/hygienic-labels-in-let.rs46
-rw-r--r--src/test/ui/hygiene/hygienic-labels-in-let.stderr334
-rw-r--r--src/test/ui/hygiene/hygienic-labels.rs49
-rw-r--r--src/test/ui/hygiene/hygienic-labels.stderr334
-rw-r--r--src/test/ui/lint/unused_labels.stderr18
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels-2.rs36
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels-2.stderr74
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels.rs49
-rw-r--r--src/test/ui/loops/loops-reject-duplicate-labels.stderr74
-rw-r--r--src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs109
-rw-r--r--src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr104
-rw-r--r--src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs36
-rw-r--r--src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr18
-rw-r--r--src/test/ui/macros/macro-lifetime-used-with-labels.rs2
-rw-r--r--src/test/ui/macros/macro-lifetime-used-with-labels.stderr15
-rw-r--r--src/test/ui/regions/regions-name-duplicated.rs5
-rw-r--r--src/test/ui/regions/regions-name-duplicated.stderr8
26 files changed, 78 insertions, 1395 deletions
diff --git a/src/test/ui/error-codes/E0263.rs b/src/test/ui/error-codes/E0263.rs
index 4376437823c..92917678e4c 100644
--- a/src/test/ui/error-codes/E0263.rs
+++ b/src/test/ui/error-codes/E0263.rs
@@ -1,5 +1,5 @@
 fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
-    //~^ ERROR E0263
+    //~^ ERROR E0403
 }
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr
index 4dae02b85c3..e3f9aea296a 100644
--- a/src/test/ui/error-codes/E0263.stderr
+++ b/src/test/ui/error-codes/E0263.stderr
@@ -1,11 +1,11 @@
-error[E0263]: lifetime name `'a` declared twice in the same scope
+error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters
   --> $DIR/E0263.rs:1:16
    |
 LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
-   |        --      ^^ declared twice
+   |        --      ^^ already used
    |        |
-   |        previous declaration here
+   |        first use of `'a`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0263`.
+For more information about this error, try `rustc --explain E0403`.
diff --git a/src/test/ui/for-loop-while/label_break_value.rs b/src/test/ui/for-loop-while/label_break_value.rs
index 5776c0b1e0c..ca9d71a7a8b 100644
--- a/src/test/ui/for-loop-while/label_break_value.rs
+++ b/src/test/ui/for-loop-while/label_break_value.rs
@@ -102,7 +102,7 @@ fn label_break_match(c: u8, xe: u8, ye: i8) {
             0 => break 'a 0,
             v if { if v % 2 == 0 { break 'a 1; }; v % 3 == 0 } => { x += 1; },
             v if { 'b: { break 'b v == 5; } } => { x = 41; },
-            _ => 'b: { //~ WARNING `'b` shadows a label
+            _ => 'b: {
                 break 'b ();
             },
         }
@@ -128,8 +128,8 @@ fn label_break_macro() {
         0
     };
     assert_eq!(x, 0);
-    let x: u8 = 'a: { //~ WARNING `'a` shadows a label
-        'b: { //~ WARNING `'b` shadows a label
+    let x: u8 = 'a: {
+        'b: {
             if true {
                 mac1!('a, 1);
             }
diff --git a/src/test/ui/for-loop-while/label_break_value.stderr b/src/test/ui/for-loop-while/label_break_value.stderr
deleted file mode 100644
index b1eb3204fd5..00000000000
--- a/src/test/ui/for-loop-while/label_break_value.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-warning: label name `'b` shadows a label name that is already in scope
-  --> $DIR/label_break_value.rs:105:18
-   |
-LL |             v if { 'b: { break 'b v == 5; } } => { x = 41; },
-   |                    -- first declared here
-LL |             _ => 'b: {
-   |                  ^^ label `'b` already in scope
-
-warning: label name `'a` shadows a label name that is already in scope
-  --> $DIR/label_break_value.rs:131:17
-   |
-LL |     let x: u8 = 'a: {
-   |                 -- first declared here
-...
-LL |     let x: u8 = 'a: {
-   |                 ^^ label `'a` already in scope
-
-warning: label name `'b` shadows a label name that is already in scope
-  --> $DIR/label_break_value.rs:132:9
-   |
-LL |         'b: {
-   |         -- first declared here
-...
-LL |         'b: {
-   |         ^^ label `'b` already in scope
-
-warning: 3 warnings emitted
-
diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.rs b/src/test/ui/for-loop-while/label_break_value_invalid.rs
index e603c8463b5..149bf17b83c 100644
--- a/src/test/ui/for-loop-while/label_break_value_invalid.rs
+++ b/src/test/ui/for-loop-while/label_break_value_invalid.rs
@@ -20,14 +20,11 @@ fn lbv_macro_test_hygiene_respected() {
     macro_rules! mac3 {
         ($val:expr) => {
             'a: {
-            //~^ WARNING `'a` shadows a label
-            //~| WARNING `'a` shadows a label
-            //~| WARNING `'a` shadows a label
                 $val
             }
         };
     }
-    let x: u8 = mac3!('b: { //~ WARNING `'b` shadows a label
+    let x: u8 = mac3!('b: {
         if true {
             break 'a 3; //~ ERROR undeclared label `'a` [E0426]
         }
diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.stderr b/src/test/ui/for-loop-while/label_break_value_invalid.stderr
index 549b394e14b..7182b8f598f 100644
--- a/src/test/ui/for-loop-while/label_break_value_invalid.stderr
+++ b/src/test/ui/for-loop-while/label_break_value_invalid.stderr
@@ -10,7 +10,7 @@ LL |                 mac2!(2);
    = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0426]: use of undeclared label `'a`
-  --> $DIR/label_break_value_invalid.rs:32:19
+  --> $DIR/label_break_value_invalid.rs:29:19
    |
 LL |     let x: u8 = mac3!('b: {
    |                       -- a label with a similar name is reachable
@@ -22,68 +22,11 @@ LL |             break 'a 3;
    |                   help: try using similarly named label: `'b`
 
 error[E0426]: use of undeclared label `'a`
-  --> $DIR/label_break_value_invalid.rs:37:29
+  --> $DIR/label_break_value_invalid.rs:34:29
    |
 LL |     let x: u8 = mac3!(break 'a 4);
    |                             ^^ undeclared label `'a`
 
-warning: label name `'a` shadows a label name that is already in scope
-  --> $DIR/label_break_value_invalid.rs:22:13
-   |
-LL |       let x: u8 = 'a: {
-   |                   -- first declared here
-...
-LL |               'a: {
-   |               ^^ label `'a` already in scope
-...
-LL |       let x: u8 = mac3!('b: {
-   |  _________________-
-LL | |         if true {
-LL | |             break 'a 3;
-LL | |         }
-LL | |         0
-LL | |     });
-   | |______- in this macro invocation
-   |
-   = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'b` shadows a label name that is already in scope
-  --> $DIR/label_break_value_invalid.rs:30:23
-   |
-LL |         'b: {
-   |         -- first declared here
-...
-LL |     let x: u8 = mac3!('b: {
-   |                       ^^ label `'b` already in scope
-
-warning: label name `'a` shadows a label name that is already in scope
-  --> $DIR/label_break_value_invalid.rs:22:13
-   |
-LL |     let x: u8 = 'a: {
-   |                 -- first declared here
-...
-LL |             'a: {
-   |             ^^ label `'a` already in scope
-...
-LL |     let x: u8 = mac3!(break 'a 4);
-   |                 ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'a` shadows a label name that is already in scope
-  --> $DIR/label_break_value_invalid.rs:22:13
-   |
-LL |             'a: {
-   |             ^^
-   |             |
-   |             first declared here
-   |             label `'a` already in scope
-...
-LL |     let x: u8 = mac3!(break 'a 4);
-   |                 ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 3 previous errors; 4 warnings emitted
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/ui/generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr
index 857757f8940..be765920975 100644
--- a/src/test/ui/generic-associated-types/shadowing.stderr
+++ b/src/test/ui/generic-associated-types/shadowing.stderr
@@ -1,3 +1,19 @@
+error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
+  --> $DIR/shadowing.rs:4:14
+   |
+LL | trait Shadow<'a> {
+   |              -- first declared here
+LL |     type Bar<'a>;
+   |              ^^ lifetime `'a` already in scope
+
+error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
+  --> $DIR/shadowing.rs:13:14
+   |
+LL | impl<'a> NoShadow<'a> for &'a u32 {
+   |      -- first declared here
+LL |     type Bar<'a> = i32;
+   |              ^^ lifetime `'a` already in scope
+
 error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
   --> $DIR/shadowing.rs:18:14
    |
@@ -14,22 +30,6 @@ LL | impl<T> NoShadowT<T> for Option<T> {
 LL |     type Bar<T> = i32;
    |              ^ already used
 
-error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
-  --> $DIR/shadowing.rs:13:14
-   |
-LL | impl<'a> NoShadow<'a> for &'a u32 {
-   |      -- first declared here
-LL |     type Bar<'a> = i32;
-   |              ^^ lifetime `'a` already in scope
-
-error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
-  --> $DIR/shadowing.rs:4:14
-   |
-LL | trait Shadow<'a> {
-   |              -- first declared here
-LL |     type Bar<'a>;
-   |              ^^ lifetime `'a` already in scope
-
 error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0403, E0496.
diff --git a/src/test/ui/hygiene/duplicate_lifetimes.rs b/src/test/ui/hygiene/duplicate_lifetimes.rs
index e7312b51dbc..8971fb62626 100644
--- a/src/test/ui/hygiene/duplicate_lifetimes.rs
+++ b/src/test/ui/hygiene/duplicate_lifetimes.rs
@@ -5,12 +5,12 @@
 
 #[rustc_macro_transparency = "semitransparent"]
 macro m($a:lifetime) {
-    fn g<$a, 'a>() {} //~ ERROR lifetime name `'a` declared twice
+    fn g<$a, 'a>() {} //~ ERROR the name `'a` is already used for a generic parameter
 }
 
 #[rustc_macro_transparency = "transparent"]
 macro n($a:lifetime) {
-    fn h<$a, 'a>() {} //~ ERROR lifetime name `'a` declared twice
+    fn h<$a, 'a>() {} //~ ERROR the name `'a` is already used for a generic parameter
 }
 
 m!('a);
diff --git a/src/test/ui/hygiene/duplicate_lifetimes.stderr b/src/test/ui/hygiene/duplicate_lifetimes.stderr
index 4d41ebaa437..9f1a7514727 100644
--- a/src/test/ui/hygiene/duplicate_lifetimes.stderr
+++ b/src/test/ui/hygiene/duplicate_lifetimes.stderr
@@ -1,31 +1,31 @@
-error[E0263]: lifetime name `'a` declared twice in the same scope
+error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters
   --> $DIR/duplicate_lifetimes.rs:8:14
    |
 LL |     fn g<$a, 'a>() {}
-   |              ^^ declared twice
+   |              ^^ already used
 ...
 LL | m!('a);
    | ------
    | |  |
-   | |  previous declaration here
+   | |  first use of `'a`
    | in this macro invocation
    |
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0263]: lifetime name `'a` declared twice in the same scope
+error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters
   --> $DIR/duplicate_lifetimes.rs:13:14
    |
 LL |     fn h<$a, 'a>() {}
-   |              ^^ declared twice
+   |              ^^ already used
 ...
 LL | n!('a);
    | ------
    | |  |
-   | |  previous declaration here
+   | |  first use of `'a`
    | in this macro invocation
    |
    = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0263`.
+For more information about this error, try `rustc --explain E0403`.
diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs
index 491855d7bec..8cf66f31a0a 100644
--- a/src/test/ui/hygiene/hygienic-labels-in-let.rs
+++ b/src/test/ui/hygiene/hygienic-labels-in-let.rs
@@ -13,38 +13,28 @@
 macro_rules! loop_x {
     ($e: expr) => {
         // $e shouldn't be able to interact with this 'x
-        'x: loop { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: loop {
+            $e
+        }
+    };
 }
 
 macro_rules! while_true {
     ($e: expr) => {
         // $e shouldn't be able to interact with this 'x
-        'x: while 1 + 1 == 2 { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: while 1 + 1 == 2 {
+            $e
+        }
+    };
 }
 
 macro_rules! run_once {
     ($e: expr) => {
         // ditto
-        'x: for _ in 0..1 { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: for _ in 0..1 {
+            $e
+        }
+    };
 }
 
 pub fn main() {
@@ -62,8 +52,6 @@ pub fn main() {
 
     let k: isize = {
         'x: for _ in 0..1 {
-            //~^ WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
             // ditto
             loop_x!(break 'x);
             i += 1;
@@ -74,10 +62,6 @@ pub fn main() {
 
     let l: isize = {
         'x: for _ in 0..1 {
-            //~^ WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
             // ditto
             while_true!(break 'x);
             i += 1;
@@ -88,12 +72,6 @@ pub fn main() {
 
     let n: isize = {
         'x: for _ in 0..1 {
-            //~^ WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
-            //~| WARNING shadows a label name that is already in scope
             // ditto
             run_once!(continue 'x);
             i += 1;
diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr
deleted file mode 100644
index 519e3c0880a..00000000000
--- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: loop {
-   |         -- first declared here
-LL |             // this 'x should refer to the outer loop, lexically
-LL |             loop_x!(break 'x);
-   |             ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:64:9
-   |
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |             loop_x!(break 'x);
-   |             ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^
-   |         |
-   |         first declared here
-   |         label `'x` already in scope
-...
-LL |             loop_x!(break 'x);
-   |             ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             loop_x!(break 'x);
-   |             ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:76:9
-   |
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |             while_true!(break 'x);
-   |             --------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:27:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |             while_true!(break 'x);
-   |             --------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             while_true!(break 'x);
-   |             --------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:27:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |             while_true!(break 'x);
-   |             --------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             while_true!(break 'x);
-   |             --------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:90:9
-   |
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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
-   |
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 {
-   |         ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: loop {
-   |         -- first declared here
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:39:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:39:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels-in-let.rs:39:9
-   |
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: for _ in 0..1 {
-   |         -- first declared here
-...
-LL |             run_once!(continue 'x);
-   |             ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: 28 warnings emitted
-
diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs
index c9f494b68b4..6a7d81f045b 100644
--- a/src/test/ui/hygiene/hygienic-labels.rs
+++ b/src/test/ui/hygiene/hygienic-labels.rs
@@ -10,38 +10,28 @@
 macro_rules! loop_x {
     ($e: expr) => {
         // $e shouldn't be able to interact with this 'x
-        'x: loop { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: loop {
+            $e
+        }
+    };
 }
 
 macro_rules! run_once {
     ($e: expr) => {
         // ditto
-        'x: for _ in 0..1 { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: for _ in 0..1 {
+            $e
+        }
+    };
 }
 
 macro_rules! while_x {
     ($e: expr) => {
         // ditto
-        'x: while 1 + 1 == 2 { $e }
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-    }
+        'x: while 1 + 1 == 2 {
+            $e
+        }
+    };
 }
 
 pub fn main() {
@@ -52,32 +42,17 @@ pub fn main() {
     }
 
     'x: loop {
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-
         // ditto
         loop_x!(break 'x);
         panic!("break doesn't act hygienically inside infinite loop");
     }
 
     'x: while 1 + 1 == 2 {
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-
         while_x!(break 'x);
         panic!("break doesn't act hygienically inside infinite while loop");
     }
 
     'x: for _ in 0..1 {
-        //~^ WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-        //~| WARNING shadows a label name that is already in scope
-
         // ditto
         run_once!(continue 'x);
         panic!("continue doesn't act hygienically inside for loop");
diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr
deleted file mode 100644
index f0b891fe349..00000000000
--- a/src/test/ui/hygiene/hygienic-labels.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:13:9
-   |
-LL |         'x: loop { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-LL |         // this 'x should refer to the outer loop, lexically
-LL |         loop_x!(break 'x);
-   |         ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:54:5
-   |
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |     'x: loop {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:54:5
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |     'x: loop {
-   |     ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |         loop_x!(break 'x);
-   |         ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:13:9
-   |
-LL |         'x: loop { $e }
-   |         ^^
-   |         |
-   |         first declared here
-   |         label `'x` already in scope
-...
-LL |         loop_x!(break 'x);
-   |         ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:13:9
-   |
-LL |         'x: loop { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: loop {
-   |     -- first declared here
-...
-LL |         loop_x!(break 'x);
-   |         ----------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:63:5
-   |
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:63:5
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:63:5
-   |
-LL |     'x: loop {
-   |     -- first declared here
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:63:5
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |         while_x!(break 'x);
-   |         ------------------ in this macro invocation
-   |
-   = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:38:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |         while_x!(break 'x);
-   |         ------------------ in this macro invocation
-   |
-   = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: loop {
-   |     -- first declared here
-...
-LL |         while_x!(break 'x);
-   |         ------------------ in this macro invocation
-   |
-   = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:38:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |         while_x!(break 'x);
-   |         ------------------ in this macro invocation
-   |
-   = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     -- first declared here
-...
-LL |         while_x!(break 'x);
-   |         ------------------ in this macro invocation
-   |
-   = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |     'x: loop {
-   |     -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |     'x: while 1 + 1 == 2 {
-   |     -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ label `'x` already in scope
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:73:5
-   |
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         -- first declared here
-...
-LL |     'x: for _ in 0..1 {
-   |     ^^ 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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:24:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: loop {
-   |     -- first declared here
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: label name `'x` shadows a label name that is already in scope
-  --> $DIR/hygienic-labels.rs:24:9
-   |
-LL |         'x: loop { $e }
-   |         -- first declared here
-...
-LL |         'x: for _ in 0..1 { $e }
-   |         ^^ label `'x` already in scope
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: while 1 + 1 == 2 {
-   |     -- first declared here
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |         'x: while 1 + 1 == 2 { $e }
-   |         -- first declared here
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-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 }
-   |         ^^ label `'x` already in scope
-...
-LL |     'x: for _ in 0..1 {
-   |     -- first declared here
-...
-LL |         run_once!(continue 'x);
-   |         ---------------------- in this macro invocation
-   |
-   = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: 28 warnings emitted
-
diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr
index 4bb1a437d24..85adc9ab3bf 100644
--- a/src/test/ui/lint/unused_labels.stderr
+++ b/src/test/ui/lint/unused_labels.stderr
@@ -1,3 +1,12 @@
+warning: label name `'many_used_shadowed` shadows a label name that is already in scope
+  --> $DIR/unused_labels.rs:62:9
+   |
+LL |     'many_used_shadowed: for _ in 0..10 {
+   |     ------------------- first declared here
+LL |
+LL |         'many_used_shadowed: for _ in 0..10 {
+   |         ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope
+
 warning: unused label
   --> $DIR/unused_labels.rs:11:5
    |
@@ -52,14 +61,5 @@ warning: unused label
 LL |     'unused_block_label: {
    |     ^^^^^^^^^^^^^^^^^^^
 
-warning: label name `'many_used_shadowed` shadows a label name that is already in scope
-  --> $DIR/unused_labels.rs:62:9
-   |
-LL |     'many_used_shadowed: for _ in 0..10 {
-   |     ------------------- first declared here
-LL |
-LL |         'many_used_shadowed: for _ in 0..10 {
-   |         ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope
-
 warning: 9 warnings emitted
 
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops/loops-reject-duplicate-labels-2.rs
deleted file mode 100644
index 68a19a8f6f7..00000000000
--- a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// check-pass
-#![feature(label_break_value)]
-
-// Issue #21633: reject duplicate loop labels and block labels in function bodies.
-//
-// This is testing the generalization (to the whole function body)
-// discussed here:
-// https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833
-
-#[allow(unused_labels)]
-pub fn foo() {
-    { 'fl: for _ in 0..10 { break; } }
-    { 'fl: loop { break; } }             //~ WARN label name `'fl` shadows a label name that is already in scope
-    { 'lf: loop { break; } }
-    { 'lf: for _ in 0..10 { break; } }   //~ WARN label name `'lf` shadows a label name that is already in scope
-    { 'wl: while 2 > 1 { break; } }
-    { 'wl: loop { break; } }             //~ WARN label name `'wl` shadows a label name that is already in scope
-    { 'lw: loop { break; } }
-    { 'lw: while 2 > 1 { break; } }      //~ WARN label name `'lw` shadows a label name that is already in scope
-    { 'fw: for _ in 0..10 { break; } }
-    { 'fw: while 2 > 1 { break; } }      //~ WARN label name `'fw` shadows a label name that is already in scope
-    { 'wf: while 2 > 1 { break; } }
-    { 'wf: for _ in 0..10 { break; } }   //~ WARN label name `'wf` shadows a label name that is already in scope
-    { 'tl: while let Some(_) = None::<i32> { break; } }
-    { 'tl: loop { break; } }             //~ WARN label name `'tl` shadows a label name that is already in scope
-    { 'lt: loop { break; } }
-    { 'lt: while let Some(_) = None::<i32> { break; } }
-                                         //~^ WARN label name `'lt` shadows a label name that is already in scope
-    { 'bl: {} }
-    { 'bl: {} } //~ WARN label name `'bl` shadows a label name that is already in scope
-}
-
-
-pub fn main() {
-    foo();
-}
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
deleted file mode 100644
index 2c372fcff7a..00000000000
--- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
+++ /dev/null
@@ -1,74 +0,0 @@
-warning: label name `'fl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels-2.rs:13:7
-   |
-LL |     { 'fl: for _ in 0..10 { break; } }
-   |       --- first declared here
-LL |     { 'fl: loop { break; } }
-   |       ^^^ 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:15:7
-   |
-LL |     { 'lf: loop { break; } }
-   |       --- first declared here
-LL |     { 'lf: for _ in 0..10 { break; } }
-   |       ^^^ 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:17:7
-   |
-LL |     { 'wl: while 2 > 1 { break; } }
-   |       --- first declared here
-LL |     { 'wl: loop { break; } }
-   |       ^^^ 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:19:7
-   |
-LL |     { 'lw: loop { break; } }
-   |       --- first declared here
-LL |     { 'lw: while 2 > 1 { break; } }
-   |       ^^^ 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:21:7
-   |
-LL |     { 'fw: for _ in 0..10 { break; } }
-   |       --- first declared here
-LL |     { 'fw: while 2 > 1 { break; } }
-   |       ^^^ 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:23:7
-   |
-LL |     { 'wf: while 2 > 1 { break; } }
-   |       --- first declared here
-LL |     { 'wf: for _ in 0..10 { break; } }
-   |       ^^^ 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:25:7
-   |
-LL |     { 'tl: while let Some(_) = None::<i32> { break; } }
-   |       --- first declared here
-LL |     { 'tl: loop { break; } }
-   |       ^^^ 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:27:7
-   |
-LL |     { 'lt: loop { break; } }
-   |       --- first declared here
-LL |     { 'lt: while let Some(_) = None::<i32> { break; } }
-   |       ^^^ label `'lt` already in scope
-
-warning: label name `'bl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels-2.rs:30:7
-   |
-LL |     { 'bl: {} }
-   |       --- first declared here
-LL |     { 'bl: {} }
-   |       ^^^ label `'bl` already in scope
-
-warning: 9 warnings emitted
-
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.rs b/src/test/ui/loops/loops-reject-duplicate-labels.rs
deleted file mode 100644
index c34bcf3df1d..00000000000
--- a/src/test/ui/loops/loops-reject-duplicate-labels.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-// check-pass
-#![feature(label_break_value)]
-
-// Issue #21633: reject duplicate loop labels and block labels in function bodies.
-
-#[allow(unused_labels)]
-fn foo() {
-    'fl: for _ in 0..10 { break; }
-    'fl: loop { break; }           //~ WARN label name `'fl` shadows a label name that is already in scope
-
-    'lf: loop { break; }
-    'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope
-    'wl: while 2 > 1 { break; }
-    'wl: loop { break; }           //~ WARN label name `'wl` shadows a label name that is already in scope
-    'lw: loop { break; }
-    'lw: while 2 > 1 { break; }    //~ WARN label name `'lw` shadows a label name that is already in scope
-    'fw: for _ in 0..10 { break; }
-    'fw: while 2 > 1 { break; }    //~ WARN label name `'fw` shadows a label name that is already in scope
-    'wf: while 2 > 1 { break; }
-    'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope
-    'tl: while let Some(_) = None::<i32> { break; }
-    'tl: loop { break; }           //~ WARN label name `'tl` shadows a label name that is already in scope
-    'lt: loop { break; }
-    'lt: while let Some(_) = None::<i32> { break; }
-                                   //~^ WARN label name `'lt` shadows a label name that is already in scope
-    'bl: {}
-    'bl: {} //~ WARN label name `'bl` shadows a label name that is already in scope
-}
-
-// Note however that it is okay for the same label to be reused in
-// different methods of one impl, as illustrated here.
-
-struct S;
-impl S {
-    fn m1(&self) { 'okay: loop { break 'okay; } }
-    fn m2(&self) { 'okay: loop { break 'okay; } }
-    fn m3(&self) { 'okay: { break 'okay; } }
-    fn m4(&self) { 'okay: { break 'okay; } }
-}
-
-
-pub fn main() {
-    let s = S;
-    s.m1();
-    s.m2();
-    s.m3();
-    s.m4();
-    foo();
-}
diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr
deleted file mode 100644
index 3bf3af763ec..00000000000
--- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr
+++ /dev/null
@@ -1,74 +0,0 @@
-warning: label name `'fl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:9:5
-   |
-LL |     'fl: for _ in 0..10 { break; }
-   |     --- first declared here
-LL |     'fl: loop { break; }
-   |     ^^^ label `'fl` already in scope
-
-warning: label name `'lf` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:12:5
-   |
-LL |     'lf: loop { break; }
-   |     --- first declared here
-LL |     'lf: for _ in 0..10 { break; }
-   |     ^^^ label `'lf` already in scope
-
-warning: label name `'wl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:14:5
-   |
-LL |     'wl: while 2 > 1 { break; }
-   |     --- first declared here
-LL |     'wl: loop { break; }
-   |     ^^^ label `'wl` already in scope
-
-warning: label name `'lw` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:16:5
-   |
-LL |     'lw: loop { break; }
-   |     --- first declared here
-LL |     'lw: while 2 > 1 { break; }
-   |     ^^^ label `'lw` already in scope
-
-warning: label name `'fw` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:18:5
-   |
-LL |     'fw: for _ in 0..10 { break; }
-   |     --- first declared here
-LL |     'fw: while 2 > 1 { break; }
-   |     ^^^ label `'fw` already in scope
-
-warning: label name `'wf` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:20:5
-   |
-LL |     'wf: while 2 > 1 { break; }
-   |     --- first declared here
-LL |     'wf: for _ in 0..10 { break; }
-   |     ^^^ label `'wf` already in scope
-
-warning: label name `'tl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:22:5
-   |
-LL |     'tl: while let Some(_) = None::<i32> { break; }
-   |     --- first declared here
-LL |     'tl: loop { break; }
-   |     ^^^ label `'tl` already in scope
-
-warning: label name `'lt` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:24:5
-   |
-LL |     'lt: loop { break; }
-   |     --- first declared here
-LL |     'lt: while let Some(_) = None::<i32> { break; }
-   |     ^^^ label `'lt` already in scope
-
-warning: label name `'bl` shadows a label name that is already in scope
-  --> $DIR/loops-reject-duplicate-labels.rs:27:5
-   |
-LL |     'bl: {}
-   |     --- first declared here
-LL |     'bl: {}
-   |     ^^^ label `'bl` already in scope
-
-warning: 9 warnings emitted
-
diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs
deleted file mode 100644
index 741ea0c1ca8..00000000000
--- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Issue #21633: reject duplicate loop labels in function bodies.
-// This is testing interaction between lifetime-params and labels.
-
-// check-pass
-
-#![allow(dead_code, unused_variables)]
-
-fn foo() {
-    fn foo<'a>() {
-        'a: loop { break 'a; }
-        //~^ WARN label name `'a` shadows a lifetime name that is already in scope
-    }
-
-    struct Struct<'b, 'c> { _f: &'b i8, _g: &'c i8 }
-    enum Enum<'d, 'e> { A(&'d i8), B(&'e i8) }
-
-    impl<'d, 'e> Struct<'d, 'e> {
-        fn meth_okay() {
-            'a: loop { break 'a; }
-            'b: loop { break 'b; }
-            'c: loop { break 'c; }
-        }
-    }
-
-    impl <'d, 'e> Enum<'d, 'e> {
-        fn meth_okay() {
-            'a: loop { break 'a; }
-            'b: loop { break 'b; }
-            'c: loop { break 'c; }
-        }
-    }
-
-    impl<'bad, 'c> Struct<'bad, 'c> {
-        fn meth_bad(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-
-    impl<'b, 'bad> Struct<'b, 'bad> {
-        fn meth_bad2(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-
-    impl<'b, 'c> Struct<'b, 'c> {
-        fn meth_bad3<'bad>(x: &'bad i8) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-
-        fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-
-    impl <'bad, 'e> Enum<'bad, 'e> {
-        fn meth_bad(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-    impl <'d, 'bad> Enum<'d, 'bad> {
-        fn meth_bad2(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-    impl <'d, 'e> Enum<'d, 'e> {
-        fn meth_bad3<'bad>(x: &'bad i8) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-
-        fn meth_bad4<'a,'bad>(x: &'bad i8) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-
-    trait HasDefaultMethod1<'bad> {
-        fn meth_okay() {
-            'c: loop { break 'c; }
-        }
-        fn meth_bad(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-    trait HasDefaultMethod2<'a,'bad> {
-        fn meth_bad(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-    trait HasDefaultMethod3<'a,'b> {
-        fn meth_bad<'bad>(&self) {
-            'bad: loop { break 'bad; }
-            //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
-        }
-    }
-}
-
-
-pub fn main() {
-    foo();
-}
diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
deleted file mode 100644
index 0d96c0b3a35..00000000000
--- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
+++ /dev/null
@@ -1,104 +0,0 @@
-warning: label name `'a` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:10:9
-   |
-LL |     fn foo<'a>() {
-   |            -- first declared here
-LL |         'a: loop { break 'a; }
-   |         ^^ 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
-   |
-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
-
-warning: label name `'bad` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:42:13
-   |
-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
-
-warning: label name `'bad` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:49:13
-   |
-LL |         fn meth_bad3<'bad>(x: &'bad i8) {
-   |                      ---- first declared here
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ 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
-   |
-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
-
-warning: label name `'bad` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:61:13
-   |
-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
-
-warning: label name `'bad` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:67:13
-   |
-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
-
-warning: label name `'bad` shadows a lifetime name that is already in scope
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:73:13
-   |
-LL |         fn meth_bad3<'bad>(x: &'bad i8) {
-   |                      ---- first declared here
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ 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
-   |
-LL |         fn meth_bad4<'a,'bad>(x: &'bad i8) {
-   |                         ---- first declared here
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ 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
-   |
-LL |     trait HasDefaultMethod1<'bad> {
-   |                             ---- first declared here
-...
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ 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
-   |
-LL |     trait HasDefaultMethod2<'a,'bad> {
-   |                                ---- first declared here
-LL |         fn meth_bad(&self) {
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ 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
-   |
-LL |         fn meth_bad<'bad>(&self) {
-   |                     ---- first declared here
-LL |             'bad: loop { break 'bad; }
-   |             ^^^^ lifetime `'bad` already in scope
-
-warning: 12 warnings emitted
-
diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs
deleted file mode 100644
index ce2d07eb06a..00000000000
--- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// check-pass
-#![feature(label_break_value)]
-#![allow(dead_code, unused_variables)]
-
-// Issue #21633:  reject duplicate loop labels and block labels in function bodies.
-//
-// Test rejection of lifetimes in *expressions* that shadow labels.
-
-fn foo() {
-    // Reusing lifetime `'a` in function item is okay.
-    fn foo<'a>(x: &'a i8) -> i8 { *x }
-
-    // So is reusing `'a` in struct item
-    struct S1<'a> { x: &'a i8 } impl<'a> S1<'a> { fn m(&self) {} }
-    // and a method item
-    struct S2; impl S2 { fn m<'a>(&self) {} }
-
-    let z = 3_i8;
-
-    'a: loop {
-        let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>;
-        //~^ WARN lifetime name `'a` shadows a label name that is already in scope
-        assert_eq!((*b)(&z), z);
-        break 'a;
-    }
-
-    'b: {
-        let b = Box::new(|x: &()| ()) as Box<dyn for <'b> Fn(&'b ())>;
-        //~^ WARN lifetime name `'b` shadows a label name that is already in scope
-        break 'b;
-    }
-}
-
-pub fn main() {
-    foo();
-}
diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
deleted file mode 100644
index 9702b71600b..00000000000
--- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: lifetime name `'a` shadows a label name that is already in scope
-  --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:55
-   |
-LL |     'a: loop {
-   |     -- first declared here
-LL |         let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>;
-   |                                                       ^^ label `'a` already in scope
-
-warning: lifetime name `'b` shadows a label name that is already in scope
-  --> $DIR/loops-reject-lifetime-shadowing-label.rs:28:55
-   |
-LL |     'b: {
-   |     -- first declared here
-LL |         let b = Box::new(|x: &()| ()) as Box<dyn for <'b> Fn(&'b ())>;
-   |                                                       ^^ label `'b` already in scope
-
-warning: 2 warnings emitted
-
diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.rs b/src/test/ui/macros/macro-lifetime-used-with-labels.rs
index 2e9da6f9dc8..59017da3b69 100644
--- a/src/test/ui/macros/macro-lifetime-used-with-labels.rs
+++ b/src/test/ui/macros/macro-lifetime-used-with-labels.rs
@@ -18,7 +18,7 @@ macro_rules! br {
 }
 macro_rules! br2 {
     ($b:lifetime) => {
-        'b: loop { //~ WARNING `'b` shadows a label name that is already in scope
+        'b: loop {
             break $b; // this $b should refer to the outer loop.
         }
     }
diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
deleted file mode 100644
index 69334e21192..00000000000
--- a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-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 {
-   |         ^^ label `'b` already in scope
-...
-LL |     'b: loop {
-   |     -- first declared here
-LL |         br2!('b);
-   |         -------- in this macro invocation
-   |
-   = note: this warning originates in the macro `br2` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: 1 warning emitted
-
diff --git a/src/test/ui/regions/regions-name-duplicated.rs b/src/test/ui/regions/regions-name-duplicated.rs
index f2adf015315..f6616591a3d 100644
--- a/src/test/ui/regions/regions-name-duplicated.rs
+++ b/src/test/ui/regions/regions-name-duplicated.rs
@@ -1,5 +1,6 @@
-struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice
-    x: &'a isize
+struct Foo<'a, 'a> {
+    //~^ ERROR the name `'a` is already used for a generic parameter
+    x: &'a isize,
 }
 
 fn main() {}
diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr
index a7e03a61adc..cef73c18d37 100644
--- a/src/test/ui/regions/regions-name-duplicated.stderr
+++ b/src/test/ui/regions/regions-name-duplicated.stderr
@@ -1,11 +1,11 @@
-error[E0263]: lifetime name `'a` declared twice in the same scope
+error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters
   --> $DIR/regions-name-duplicated.rs:1:16
    |
 LL | struct Foo<'a, 'a> {
-   |            --  ^^ declared twice
+   |            --  ^^ already used
    |            |
-   |            previous declaration here
+   |            first use of `'a`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0263`.
+For more information about this error, try `rustc --explain E0403`.