summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-09-19 16:23:21 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-09-20 22:40:44 -0700
commit06d577d8b25b5f2e131005a6bcc2e142748016e5 (patch)
treeadd80951760c8263168ec6a5b6f4caae9855f67a /src/test/ui/parser
parent20dc0c50704ba1fc8c56a88ae2bf05ddb3e419bc (diff)
downloadrust-06d577d8b25b5f2e131005a6bcc2e142748016e5.tar.gz
rust-06d577d8b25b5f2e131005a6bcc2e142748016e5.zip
Detect `for _ in in bar {}` typo
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/if-in-in.rs5
-rw-r--r--src/test/ui/parser/if-in-in.stderr13
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/parser/if-in-in.rs b/src/test/ui/parser/if-in-in.rs
new file mode 100644
index 00000000000..9bc9aaff298
--- /dev/null
+++ b/src/test/ui/parser/if-in-in.rs
@@ -0,0 +1,5 @@
+fn main() {
+    for i in in 1..2 {
+        println!("{}", i);
+    }
+}
diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr
new file mode 100644
index 00000000000..9926fcc0858
--- /dev/null
+++ b/src/test/ui/parser/if-in-in.stderr
@@ -0,0 +1,13 @@
+error: expected iterable, found keyword `in`
+  --> $DIR/if-in-in.rs:2:14
+   |
+LL |     for i in in 1..2 {
+   |           ---^^
+   |           |
+   |           help: remove the duplicated `in`
+   |
+   = note: if you meant to use emplacement syntax, it is obsolete (for now, anyway)
+   = note: for more information on the status of emplacement syntax, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>
+
+error: aborting due to previous error
+