From 40c9bc06bf29a8f41c2c31daf025a431d3513eae Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 12 Mar 2022 13:09:57 -0700 Subject: [PATCH] diagnostics: regression test for ::rev Closes #90315 --- src/test/ui/methods/issues/issue-90315.rs | 7 +++++++ src/test/ui/methods/issues/issue-90315.stderr | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/test/ui/methods/issues/issue-90315.rs create mode 100644 src/test/ui/methods/issues/issue-90315.stderr diff --git a/src/test/ui/methods/issues/issue-90315.rs b/src/test/ui/methods/issues/issue-90315.rs new file mode 100644 index 0000000000000..01bf9f4840246 --- /dev/null +++ b/src/test/ui/methods/issues/issue-90315.rs @@ -0,0 +1,7 @@ +fn main() { + let arr = &[0,1,2,3]; + for _i in 0..arr.len().rev() { //~ERROR not an iterator + // The above error used to say “the method `rev` exists for type `usize`”. + // This regression test ensures it doesn't say that any more. + } +} diff --git a/src/test/ui/methods/issues/issue-90315.stderr b/src/test/ui/methods/issues/issue-90315.stderr new file mode 100644 index 0000000000000..c6a76c9e79018 --- /dev/null +++ b/src/test/ui/methods/issues/issue-90315.stderr @@ -0,0 +1,13 @@ +error[E0599]: `usize` is not an iterator + --> $DIR/issue-90315.rs:3:26 + | +LL | for _i in 0..arr.len().rev() { + | ^^^ `usize` is not an iterator + | + = note: the following trait bounds were not satisfied: + `usize: Iterator` + which is required by `&mut usize: Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`.