Add test tracking recovery for misspelled item keyword
This commit is contained in:
parent
672388edbe
commit
f9b30df1b0
2 changed files with 54 additions and 0 deletions
23
tests/ui/parser/misspelled-keywords/recovery.rs
Normal file
23
tests/ui/parser/misspelled-keywords/recovery.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Shows that we perform recovery on misspelled item keyword.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
trait Animal {
|
||||
Type Result = u8;
|
||||
//~^ ERROR expected one of
|
||||
}
|
||||
|
||||
Struct Foor {
|
||||
//~^ ERROR expected one of
|
||||
hello: String,
|
||||
}
|
||||
|
||||
Const A: u8 = 10;
|
||||
|
||||
Fn code() {}
|
||||
|
||||
Static a: u8 = 0;
|
||||
|
||||
usee a::b;
|
||||
|
||||
fn main() {}
|
||||
31
tests/ui/parser/misspelled-keywords/recovery.stderr
Normal file
31
tests/ui/parser/misspelled-keywords/recovery.stderr
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
error: expected one of `!` or `::`, found `Result`
|
||||
--> $DIR/recovery.rs:6:10
|
||||
|
|
||||
LL | trait Animal {
|
||||
| - while parsing this item list starting here
|
||||
LL | Type Result = u8;
|
||||
| ^^^^^^ expected one of `!` or `::`
|
||||
LL |
|
||||
LL | }
|
||||
| - the item list ends here
|
||||
|
|
||||
help: write keyword `type` in lowercase
|
||||
|
|
||||
LL - Type Result = u8;
|
||||
LL + type Result = u8;
|
||||
|
|
||||
|
||||
error: expected one of `!` or `::`, found `Foor`
|
||||
--> $DIR/recovery.rs:10:8
|
||||
|
|
||||
LL | Struct Foor {
|
||||
| ^^^^ expected one of `!` or `::`
|
||||
|
|
||||
help: write keyword `struct` in lowercase (notice the capitalization)
|
||||
|
|
||||
LL - Struct Foor {
|
||||
LL + struct Foor {
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue