Rollup merge of #94893 - notriddle:notriddle/regression-test-issue-90315, r=Mark-Simulacrum

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

Closes #90315
This commit is contained in:
Matthias Krüger 2022-04-24 18:00:24 +02:00 committed by GitHub
commit ce0473ee03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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`.