diff options
Diffstat (limited to 'tests/ui/for/for-loop-bogosity.rs')
| -rw-r--r-- | tests/ui/for/for-loop-bogosity.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/for/for-loop-bogosity.rs b/tests/ui/for/for-loop-bogosity.rs new file mode 100644 index 00000000000..9341dea0974 --- /dev/null +++ b/tests/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); + } +} |
