diagnostics: regression test for <usize as Iterator>::rev

Closes #90315
This commit is contained in:
Michael Howell 2022-03-12 13:09:57 -07:00 committed by Mark Rousskov
parent b759b22186
commit 40c9bc06bf
2 changed files with 20 additions and 0 deletions

View file

@ -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.
}
}

View file

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