diff options
Diffstat (limited to 'tests/ui/iterators/issue-28098.rs')
-rw-r--r-- | tests/ui/iterators/issue-28098.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/iterators/issue-28098.rs b/tests/ui/iterators/issue-28098.rs new file mode 100644 index 000000000..80c77edae --- /dev/null +++ b/tests/ui/iterators/issue-28098.rs @@ -0,0 +1,31 @@ +fn main() { + let _ = Iterator::next(&mut ()); + //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + + for _ in false {} + //~^ ERROR `bool` is not an iterator + + let _ = Iterator::next(&mut ()); + //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + + other() +} + +pub fn other() { + // check errors are still reported globally + + let _ = Iterator::next(&mut ()); + //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + + let _ = Iterator::next(&mut ()); + //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator + + for _ in false {} + //~^ ERROR `bool` is not an iterator +} |