Bless tests.

This commit is contained in:
Camille GILLOT 2021-12-08 22:40:16 +01:00
parent 6e1b0105c6
commit 85cbd0bc18
16 changed files with 207 additions and 774 deletions

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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;

View File

@ -1,19 +1,5 @@
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
--> $DIR/hygienic-labels-in-let.rs:54:9
|
LL | 'x: loop {
| -- first declared here
@ -22,58 +8,7 @@ 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
--> $DIR/hygienic-labels-in-let.rs:65:9
|
LL | 'x: loop {
| -- first declared here
@ -84,251 +19,11 @@ LL | 'x: for _ in 0..1 {
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

View File

@ -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);

View File

@ -1,19 +1,5 @@
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
--> $DIR/hygienic-labels.rs:44:5
|
LL | 'x: for _ in 0..1 {
| -- first declared here
@ -22,58 +8,7 @@ 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,104 +17,7 @@ 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
--> $DIR/hygienic-labels.rs:59:5
|
LL | 'x: for _ in 0..1 {
| -- first declared here
@ -187,148 +25,5 @@ LL | 'x: for _ in 0..1 {
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
warning: 3 warnings emitted

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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.
}
}

View File

@ -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

View File

@ -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() {}

View File

@ -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`
For more information about this error, try `rustc --explain E0263`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0263, E0392.
For more information about an error, try `rustc --explain E0263`.