From 90412f149c7179f7993d4057b8234f7e1a8bee42 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 31 Aug 2018 15:40:45 +0200 Subject: [PATCH] Add `.stderr` files for shadowed labels where the point of the test is to test such cases. --- .../hygiene/hygienic-labels-in-let.stderr | 300 ++++++++++++++++++ .../run-pass/hygiene/hygienic-labels.stderr | 299 +++++++++++++++++ .../macro-lifetime-used-with-labels.stderr | 11 + 3 files changed, 610 insertions(+) create mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr create mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels.stderr create mode 100644 src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr new file mode 100644 index 00000000000..d96b99746a7 --- /dev/null +++ b/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr @@ -0,0 +1,300 @@ +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime '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 + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:55:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:55:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ + | | + | first declared here + | lifetime 'x already in scope +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels.stderr b/src/test/ui/run-pass/hygiene/hygienic-labels.stderr new file mode 100644 index 00000000000..45c0cacde9a --- /dev/null +++ b/src/test/ui/run-pass/hygiene/hygienic-labels.stderr @@ -0,0 +1,299 @@ +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime '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 + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:46:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: loop { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:46:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: loop { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ + | | + | first declared here + | lifetime 'x already in scope +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +LL | // ditto +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + diff --git a/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr new file mode 100644 index 00000000000..729178fb8f1 --- /dev/null +++ b/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr @@ -0,0 +1,11 @@ +warning: label name `'b` shadows a label name that is already in scope + --> $DIR/macro-lifetime-used-with-labels.rs:31:9 + | +LL | 'b: loop { + | ^^ lifetime 'b already in scope +... +LL | 'b: loop { + | -- first declared here +LL | br2!('b); + | --------- in this macro invocation + -- GitLab