summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for/for-loop-bogosity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/for/for-loop-bogosity.rs')
-rw-r--r--src/test/ui/for/for-loop-bogosity.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/for/for-loop-bogosity.rs b/src/test/ui/for/for-loop-bogosity.rs
new file mode 100644
index 000000000..9341dea09
--- /dev/null
+++ b/src/test/ui/for/for-loop-bogosity.rs
@@ -0,0 +1,21 @@
+struct MyStruct {
+ x: isize,
+ y: isize,
+}
+
+impl MyStruct {
+ fn next(&mut self) -> Option<isize> {
+ Some(self.x)
+ }
+}
+
+pub fn main() {
+ let mut bogus = MyStruct {
+ x: 1,
+ y: 2,
+ };
+ for x in bogus {
+ //~^ ERROR `MyStruct` is not an iterator
+ drop(x);
+ }
+}