summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for/for-loop-unconstrained-element-type.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/for/for-loop-unconstrained-element-type.rs')
-rw-r--r--src/test/ui/for/for-loop-unconstrained-element-type.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.rs b/src/test/ui/for/for-loop-unconstrained-element-type.rs
new file mode 100644
index 000000000..0c7a3516a
--- /dev/null
+++ b/src/test/ui/for/for-loop-unconstrained-element-type.rs
@@ -0,0 +1,9 @@
+// Test that `for` loops don't introduce artificial
+// constraints on the type of the binding (`i`).
+// Subtle changes in the desugaring can cause the
+// type of elements in the vector to (incorrectly)
+// fallback to `!` or `()`.
+
+fn main() {
+ for i in Vec::new() { } //~ ERROR type annotations needed
+}