diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/half-open-range-patterns/range_pat_interactions2.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/half-open-range-patterns/range_pat_interactions2.rs')
-rw-r--r-- | tests/ui/half-open-range-patterns/range_pat_interactions2.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions2.rs b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs new file mode 100644 index 000000000..4615ebd68 --- /dev/null +++ b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs @@ -0,0 +1,21 @@ +fn main() { + let mut first_or = Vec::<i32>::new(); + let mut or_two = Vec::<i32>::new(); + let mut range_from = Vec::<i32>::new(); + let mut bottom = Vec::<i32>::new(); + let mut errors_only = Vec::<i32>::new(); + + for x in -9 + 1..=(9 - 2) { + match x as i32 { + 0..=(5+1) => errors_only.push(x), + //~^ error: inclusive range with no end + //~| error: expected one of `=>`, `if`, or `|`, found `(` + 1 | -3..0 => first_or.push(x), + y @ (0..5 | 6) => or_two.push(y), + y @ 0..const { 5 + 1 } => assert_eq!(y, 5), + y @ -5.. => range_from.push(y), + y @ ..-7 => assert_eq!(y, -8), + y => bottom.push(y), + } + } +} |