Skip to content

Commit b060988

Browse files
committed
Add a test for recovery of unticked labels
1 parent 741c653 commit b060988

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
'label: loop { break label } //~ error: cannot find value `label` in this scope
3+
'label: loop { break label 0 } //~ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `0`
4+
'label: loop { continue label } //~ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `label`
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `0`
2+
--> $DIR/recover-unticked-labels.rs:3:32
3+
|
4+
LL | 'label: loop { break label 0 }
5+
| ^ expected one of 8 possible tokens
6+
7+
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `label`
8+
--> $DIR/recover-unticked-labels.rs:4:29
9+
|
10+
LL | 'label: loop { continue label }
11+
| ^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
12+
13+
error[E0425]: cannot find value `label` in this scope
14+
--> $DIR/recover-unticked-labels.rs:2:26
15+
|
16+
LL | 'label: loop { break label }
17+
| ------ ^^^^^
18+
| | |
19+
| | not found in this scope
20+
| | help: use the similarly named label: `'label`
21+
| a label with a similar name exists
22+
23+
error: aborting due to 3 previous errors
24+
25+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)