diff --git a/tests/ui/parser/misspelled-keywords/recovery.rs b/tests/ui/parser/misspelled-keywords/recovery.rs new file mode 100644 index 000000000000..32e6b2c049cc --- /dev/null +++ b/tests/ui/parser/misspelled-keywords/recovery.rs @@ -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() {} diff --git a/tests/ui/parser/misspelled-keywords/recovery.stderr b/tests/ui/parser/misspelled-keywords/recovery.stderr new file mode 100644 index 000000000000..cee2eed51478 --- /dev/null +++ b/tests/ui/parser/misspelled-keywords/recovery.stderr @@ -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 +