diff options
| author | Michael Howell <michael@notriddle.com> | 2022-03-12 13:09:57 -0700 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2022-04-24 11:14:13 -0400 |
| commit | 40c9bc06bf29a8f41c2c31daf025a431d3513eae (patch) | |
| tree | cc3bc2c642f31addae2b69c1ff6758bc78cb4aa3 | |
| parent | b759b2218649016cc40e82bdd6d958e2277ff6d7 (diff) | |
| download | rust-40c9bc06bf29a8f41c2c31daf025a431d3513eae.tar.gz rust-40c9bc06bf29a8f41c2c31daf025a431d3513eae.zip | |
diagnostics: regression test for <usize as Iterator>::rev
Closes #90315
| -rw-r--r-- | src/test/ui/methods/issues/issue-90315.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/methods/issues/issue-90315.stderr | 13 |
2 files changed, 20 insertions, 0 deletions
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 00000000000..01bf9f48402 --- /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 00000000000..c6a76c9e790 --- /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`. |
