about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2021-01-19 17:51:48 -0800
committerEsteban Küber <esteban@kuber.com.ar>2021-01-21 21:41:46 -0800
commita701ff981d8768e2b81a053bf9189ff67a2bb7ea (patch)
treedef4272e3fea867fd2caa9981ba19c6aa6ce485c /src/test
parent707ce2b798ad7bb6c1e0fce0da542d9caef07b56 (diff)
downloadrust-a701ff981d8768e2b81a053bf9189ff67a2bb7ea.tar.gz
rust-a701ff981d8768e2b81a053bf9189ff67a2bb7ea.zip
Suggest `'a` when given `a` only when appropriate
When encountering a name `a` that isn't resolved, but a label `'a` is
found in the current ribs, only suggest `'a` if this name is the value
expression of a `break` statement.

Solve FIXME.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/label/label_misspelled.stderr44
-rw-r--r--src/test/ui/loops/loop-break-value.stderr4
2 files changed, 27 insertions, 21 deletions
diff --git a/src/test/ui/label/label_misspelled.stderr b/src/test/ui/label/label_misspelled.stderr
index 8282d3ada32..7cfb6e8147d 100644
--- a/src/test/ui/label/label_misspelled.stderr
+++ b/src/test/ui/label/label_misspelled.stderr
@@ -1,74 +1,78 @@
 error[E0425]: cannot find value `LOOP` in this scope
   --> $DIR/label_misspelled.rs:3:9
    |
+LL |     'LOOP: loop {
+   |     ----- a label with a similar name exists
 LL |         LOOP;
-   |         ^^^^
-   |         |
-   |         not found in this scope
-   |         help: a label with a similar name exists: `'LOOP`
+   |         ^^^^ not found in this scope
 
 error[E0425]: cannot find value `while_loop` in this scope
   --> $DIR/label_misspelled.rs:7:9
    |
+LL |     'while_loop: while true {
+   |     ----------- a label with a similar name exists
 LL |         while_loop;
-   |         ^^^^^^^^^^
-   |         |
-   |         not found in this scope
-   |         help: a label with a similar name exists: `'while_loop`
+   |         ^^^^^^^^^^ not found in this scope
 
 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
 LL |         while_let;
-   |         ^^^^^^^^^
-   |         |
-   |         not found in this scope
-   |         help: a label with a similar name exists: `'while_let`
+   |         ^^^^^^^^^ not found in this scope
 
 error[E0425]: cannot find value `for_loop` in this scope
   --> $DIR/label_misspelled.rs:15:9
    |
+LL |     'for_loop: for _ in 0..3 {
+   |     --------- a label with a similar name exists
 LL |         for_loop;
-   |         ^^^^^^^^
-   |         |
-   |         not found in this scope
-   |         help: a label with a similar name exists: `'for_loop`
+   |         ^^^^^^^^ not found in this scope
 
 error[E0425]: cannot find value `LOOP` in this scope
   --> $DIR/label_misspelled.rs:22:15
    |
+LL |     'LOOP: loop {
+   |     ----- a label with a similar name exists
 LL |         break LOOP;
    |               ^^^^
    |               |
    |               not found in this scope
-   |               help: a label with a similar name exists: `'LOOP`
+   |               help: use the similarly named label: `'LOOP`
 
 error[E0425]: cannot find value `while_loop` in this scope
   --> $DIR/label_misspelled.rs:26:15
    |
+LL |     'while_loop: while true {
+   |     ----------- a label with a similar name exists
 LL |         break while_loop;
    |               ^^^^^^^^^^
    |               |
    |               not found in this scope
-   |               help: a label with a similar name exists: `'while_loop`
+   |               help: use the similarly named label: `'while_loop`
 
 error[E0425]: cannot find value `while_let` in this scope
   --> $DIR/label_misspelled.rs:31:15
    |
+LL |     'while_let: while let Some(_) = Some(()) {
+   |     ---------- a label with a similar name exists
 LL |         break while_let;
    |               ^^^^^^^^^
    |               |
    |               not found in this scope
-   |               help: a label with a similar name exists: `'while_let`
+   |               help: use the similarly named label: `'while_let`
 
 error[E0425]: cannot find value `for_loop` in this scope
   --> $DIR/label_misspelled.rs:36:15
    |
+LL |     'for_loop: for _ in 0..3 {
+   |     --------- a label with a similar name exists
 LL |         break for_loop;
    |               ^^^^^^^^
    |               |
    |               not found in this scope
-   |               help: a label with a similar name exists: `'for_loop`
+   |               help: use the similarly named label: `'for_loop`
 
 warning: denote infinite loops with `loop { ... }`
   --> $DIR/label_misspelled.rs:6:5
diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr
index 0237435c8b4..27104118a63 100644
--- a/src/test/ui/loops/loop-break-value.stderr
+++ b/src/test/ui/loops/loop-break-value.stderr
@@ -1,11 +1,13 @@
 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
 LL |         break LOOP;
    |               ^^^^
    |               |
    |               not found in this scope
-   |               help: a label with a similar name exists: `'LOOP`
+   |               help: use the similarly named label: `'LOOP`
 
 warning: denote infinite loops with `loop { ... }`
   --> $DIR/loop-break-value.rs:26:5