From 85cbd0bc185c4b9b36162a638c9ec3915df265b2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 8 Dec 2021 22:40:16 +0100 Subject: [PATCH] Bless tests. --- src/test/ui/error-codes/E0263.stderr | 4 +- .../generic-associated-types/shadowing.stderr | 32 +- .../ui/hygiene/duplicate_lifetimes.stderr | 8 +- src/test/ui/hygiene/hygienic-labels-in-let.rs | 43 +-- .../ui/hygiene/hygienic-labels-in-let.stderr | 311 +---------------- src/test/ui/hygiene/hygienic-labels.rs | 43 +-- src/test/ui/hygiene/hygienic-labels.stderr | 313 +----------------- src/test/ui/label/label_misspelled.stderr | 96 ++++-- src/test/ui/label/label_misspelled_2.stderr | 38 ++- src/test/ui/lint/unused_labels.rs | 1 + src/test/ui/lint/unused_labels.stderr | 33 +- src/test/ui/loops/loop-break-value.stderr | 19 +- .../macros/macro-lifetime-used-with-labels.rs | 2 +- .../macro-lifetime-used-with-labels.stderr | 15 - .../ui/regions/regions-name-duplicated.rs | 6 +- .../ui/regions/regions-name-duplicated.stderr | 17 +- 16 files changed, 207 insertions(+), 774 deletions(-) delete mode 100644 src/test/ui/macros/macro-lifetime-used-with-labels.stderr diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr index 4dae02b85c3..56e4ef02379 100644 --- a/src/test/ui/error-codes/E0263.stderr +++ b/src/test/ui/error-codes/E0263.stderr @@ -2,9 +2,9 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/E0263.rs:1:16 | LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { - | -- ^^ declared twice + | -- ^^ lifetime `'a` already in scope | | - | previous declaration here + | first declared here 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 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 NoShadowT for Option { LL | type Bar = 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.stderr b/src/test/ui/hygiene/duplicate_lifetimes.stderr index 4d41ebaa437..ade411a2544 100644 --- a/src/test/ui/hygiene/duplicate_lifetimes.stderr +++ b/src/test/ui/hygiene/duplicate_lifetimes.stderr @@ -2,12 +2,12 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/duplicate_lifetimes.rs:8:14 | LL | fn g<$a, 'a>() {} - | ^^ declared twice + | ^^ lifetime `'a` already in scope ... LL | m!('a); | ------ | | | - | | previous declaration here + | | first declared here | in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -16,12 +16,12 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/duplicate_lifetimes.rs:13:14 | LL | fn h<$a, 'a>() {} - | ^^ declared twice + | ^^ lifetime `'a` already in scope ... LL | n!('a); | ------ | | | - | | previous declaration here + | | first declared here | in this macro invocation | = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs index 491855d7bec..19f72f24459 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() { @@ -63,7 +53,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; @@ -75,9 +64,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; @@ -89,11 +75,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 index 519e3c0880a..e1c284600ea 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr @@ -1,334 +1,29 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 + --> $DIR/hygienic-labels-in-let.rs:54: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 + --> $DIR/hygienic-labels-in-let.rs:65: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 +warning: 3 warnings emitted diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs index c9f494b68b4..af8f9285273 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() { @@ -53,7 +43,6 @@ 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); @@ -62,9 +51,6 @@ pub fn main() { '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"); @@ -72,11 +58,6 @@ pub fn main() { '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); diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr index f0b891fe349..df1f3c70190 100644 --- a/src/test/ui/hygiene/hygienic-labels.stderr +++ b/src/test/ui/hygiene/hygienic-labels.stderr @@ -1,79 +1,14 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 + --> $DIR/hygienic-labels.rs:44:5 | -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 + --> $DIR/hygienic-labels.rs:52:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -82,253 +17,13 @@ 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 + --> $DIR/hygienic-labels.rs:59: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 +warning: 3 warnings emitted diff --git a/src/test/ui/label/label_misspelled.stderr b/src/test/ui/label/label_misspelled.stderr index 4b5b9e92ca0..9d42aaa58cb 100644 --- a/src/test/ui/label/label_misspelled.stderr +++ b/src/test/ui/label/label_misspelled.stderr @@ -2,7 +2,10 @@ error[E0425]: cannot find value `while_loop` in this scope --> $DIR/label_misspelled.rs:6:9 | LL | 'while_loop: while true { - | ----------- a label with a similar name exists + | ----------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | LL | while_loop; | ^^^^^^^^^^ not found in this scope @@ -11,7 +14,10 @@ error[E0425]: cannot find value `while_let` in this scope --> $DIR/label_misspelled.rs:11:9 | LL | 'while_let: while let Some(_) = Some(()) { - | ---------- a label with a similar name exists + | ---------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | LL | while_let; | ^^^^^^^^^ not found in this scope @@ -20,7 +26,10 @@ error[E0425]: cannot find value `for_loop` in this scope --> $DIR/label_misspelled.rs:16:9 | LL | 'for_loop: for _ in 0..3 { - | --------- a label with a similar name exists + | --------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | LL | for_loop; | ^^^^^^^^ not found in this scope @@ -29,7 +38,10 @@ error[E0425]: cannot find value `LOOP` in this scope --> $DIR/label_misspelled.rs:21:9 | LL | 'LOOP: loop { - | ----- a label with a similar name exists + | ----- + | | + | a label with a similar name exists + | a label with a similar name exists LL | LL | LOOP; | ^^^^ not found in this scope @@ -38,45 +50,81 @@ error[E0425]: cannot find value `LOOP` in this scope --> $DIR/label_misspelled.rs:28:15 | LL | 'LOOP: loop { - | ----- a label with a similar name exists + | ----- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` + | ^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ error[E0425]: cannot find value `while_loop` in this scope --> $DIR/label_misspelled.rs:32:15 | LL | 'while_loop: while true { - | ----------- a label with a similar name exists + | ----------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break while_loop; - | ^^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_loop` + | ^^^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'while_loop; + | ~~~~~~~~~~~ +help: use the similarly named label + | +LL | break 'while_loop; + | ~~~~~~~~~~~ error[E0425]: cannot find value `while_let` in this scope --> $DIR/label_misspelled.rs:36:15 | LL | 'while_let: while let Some(_) = Some(()) { - | ---------- a label with a similar name exists + | ---------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break while_let; - | ^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_let` + | ^^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'while_let; + | ~~~~~~~~~~ +help: use the similarly named label + | +LL | break 'while_let; + | ~~~~~~~~~~ error[E0425]: cannot find value `for_loop` in this scope --> $DIR/label_misspelled.rs:40:15 | LL | 'for_loop: for _ in 0..3 { - | --------- a label with a similar name exists + | --------- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break for_loop; - | ^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'for_loop` + | ^^^^^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'for_loop; + | ~~~~~~~~~ +help: use the similarly named label + | +LL | break 'for_loop; + | ~~~~~~~~~ warning: unused label --> $DIR/label_misspelled.rs:4:5 diff --git a/src/test/ui/label/label_misspelled_2.stderr b/src/test/ui/label/label_misspelled_2.stderr index 960646d9894..b618690340b 100644 --- a/src/test/ui/label/label_misspelled_2.stderr +++ b/src/test/ui/label/label_misspelled_2.stderr @@ -14,23 +14,41 @@ error[E0425]: cannot find value `b` in this scope --> $DIR/label_misspelled_2.rs:8:15 | LL | 'b: for _ in 0..1 { - | -- a label with a similar name exists + | -- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break b; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'b` + | ^ not found in this scope + | +help: use the similarly named label + | +LL | break 'b; + | ~~ +help: use the similarly named label + | +LL | break 'b; + | ~~ error[E0425]: cannot find value `d` in this scope --> $DIR/label_misspelled_2.rs:14:15 | LL | d: for _ in 0..1 { - | - a label with a similar name exists + | - + | | + | a label with a similar name exists + | a label with a similar name exists LL | break d; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'d` + | ^ not found in this scope + | +help: use the similarly named label + | +LL | break 'd; + | ~~ +help: use the similarly named label + | +LL | break 'd; + | ~~ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/unused_labels.rs b/src/test/ui/lint/unused_labels.rs index 8a3568f65f6..fb9a9ae2648 100644 --- a/src/test/ui/lint/unused_labels.rs +++ b/src/test/ui/lint/unused_labels.rs @@ -61,6 +61,7 @@ fn main() { //~^ WARN unused label 'many_used_shadowed: for _ in 0..10 { //~^ WARN label name `'many_used_shadowed` shadows a label name that is already in scope + //~| WARN label name `'many_used_shadowed` shadows a label name that is already in scope if 1 % 2 == 0 { break 'many_used_shadowed; } else { diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 4bb1a437d24..ed9287d54a4 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -1,3 +1,21 @@ +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: 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 | @@ -41,25 +59,16 @@ LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:72:5 + --> $DIR/unused_labels.rs:73:5 | LL | 'unused_loop_label: loop { | ^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:78:5 + --> $DIR/unused_labels.rs:79:5 | 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 +warning: 10 warnings emitted diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index ccb27c35070..5698c2693b5 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -2,12 +2,21 @@ error[E0425]: cannot find value `LOOP` in this scope --> $DIR/loop-break-value.rs:95:15 | LL | 'LOOP: for _ in 0 .. 9 { - | ----- a label with a similar name exists + | ----- + | | + | a label with a similar name exists + | a label with a similar name exists LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` + | ^^^^ not found in this scope + | +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ +help: use the similarly named label + | +LL | break 'LOOP; + | ~~~~~ warning: denote infinite loops with `loop { ... }` --> $DIR/loop-break-value.rs:26:5 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..ee9549991ce 100644 --- a/src/test/ui/regions/regions-name-duplicated.rs +++ b/src/test/ui/regions/regions-name-duplicated.rs @@ -1,5 +1,7 @@ -struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice - x: &'a isize +struct Foo<'a, 'a> { + //~^ ERROR lifetime name `'a` declared twice + //~| ERROR parameter `'a` is never used [E0392] + 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..6d6e28c8479 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -2,10 +2,19 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/regions-name-duplicated.rs:1:16 | LL | struct Foo<'a, 'a> { - | -- ^^ declared twice + | -- ^^ lifetime `'a` already in scope | | - | previous declaration here + | first declared here -error: aborting due to previous error +error[E0392]: parameter `'a` is never used + --> $DIR/regions-name-duplicated.rs:1:12 + | +LL | struct Foo<'a, 'a> { + | ^^ unused parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0263`. +Some errors have detailed explanations: E0263, E0392. +For more information about an error, try `rustc --explain E0263`. -- 2.44.0