diff --git a/tests/ui/parser/missing-expression-in-for-loop.rs b/tests/ui/parser/missing-expression-in-for-loop.rs new file mode 100644 index 00000000000..518a89a0e6f --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.rs @@ -0,0 +1,5 @@ +fn main() { + for i in { + //~^ ERROR missing expression to iterate on in `for` loop + } +} diff --git a/tests/ui/parser/missing-expression-in-for-loop.stderr b/tests/ui/parser/missing-expression-in-for-loop.stderr new file mode 100644 index 00000000000..74a7c4224fa --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.stderr @@ -0,0 +1,13 @@ +error: missing expression to iterate on in `for` loop + --> $DIR/missing-expression-in-for-loop.rs:2:14 + | +LL | for i in { + | ^ + | +help: try adding an expression to the `for` loop + | +LL | for i in /* expression */ { + | ++++++++++++++++ + +error: aborting due to previous error +