Skip to content

Commit

Permalink
Rollup merge of #94893 - notriddle:notriddle/regression-test-issue-90…
Browse files Browse the repository at this point in the history
…315, r=Mark-Simulacrum

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

Closes #90315
  • Loading branch information
matthiaskrgr authored Apr 24, 2022
2 parents d8e59ed + 40c9bc0 commit ce0473e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/ui/methods/issues/issue-90315.rs
Original file line number Diff line number Diff line change
@@ -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.
}
}
13 changes: 13 additions & 0 deletions src/test/ui/methods/issues/issue-90315.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit ce0473e

Please sign in to comment.