summaryrefslogtreecommitdiffstats
path: root/tests/ui/half-open-range-patterns
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
commit3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch)
treedaf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/ui/half-open-range-patterns
parentAdding debian version 1.68.2+dfsg1-1. (diff)
downloadrustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz
rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/half-open-range-patterns')
-rw-r--r--tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr2
-rw-r--r--tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr2
-rw-r--r--tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr6
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs9
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr15
-rw-r--r--tests/ui/half-open-range-patterns/pat-tuple-5.stderr2
6 files changed, 30 insertions, 6 deletions
diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr
index 095a1c6af..6ce56ba4b 100644
--- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr
+++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99.., _] => {},
- | ^^ expected struct `Range`, found integer
+ | ^^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr
index 2ea3205dc..6f56ecd4c 100644
--- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr
+++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr
@@ -10,7 +10,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99..] => {},
- | ^^ expected struct `Range`, found integer
+ | ^^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr
index bbdf0c83f..b9b272c4c 100644
--- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr
+++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {},
- | ^ expected struct `Range`, found integer
+ | ^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
@@ -17,7 +17,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [..9, 99..100, _] => {},
| ^^ --- this is of type `{integer}`
| |
- | expected struct `Range`, found integer
+ | expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
@@ -28,7 +28,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {},
- | -- ^^^ expected struct `Range`, found integer
+ | -- ^^^ expected `Range<{integer}>`, found integer
| |
| this is of type `{integer}`
|
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs
new file mode 100644
index 000000000..30173b1b4
--- /dev/null
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs
@@ -0,0 +1,9 @@
+fn main() {
+ let x = 42;
+ match x {
+ 0..=73 => {},
+ 74..=> {},
+ //~^ ERROR unexpected `>` after inclusive range
+ //~| NOTE this is parsed as an inclusive range `..=`
+ }
+}
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr
new file mode 100644
index 000000000..cb7f998df
--- /dev/null
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr
@@ -0,0 +1,15 @@
+error: unexpected `>` after inclusive range
+ --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14
+ |
+LL | 74..=> {},
+ | ---^
+ | |
+ | this is parsed as an inclusive range `..=`
+ |
+help: add a space between the pattern and `=>`
+ |
+LL | 74.. => {},
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr
index c60842638..43e7f03b8 100644
--- a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr
+++ b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match (0, 1) {
| ------ this expression has type `({integer}, {integer})`
LL | (PAT ..) => {}
- | ^^^ expected tuple, found `u8`
+ | ^^^ expected `({integer}, {integer})`, found `u8`
|
= note: expected tuple `({integer}, {integer})`
found type `u8`