Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.