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`.