about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-01-30 23:47:10 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-02-02 13:18:12 +0000
commit4ab75de934935f59f243ab64a641e28aa89e6fcd (patch)
treefe7cc1e8e0c9235e7452a46165c5b4b14713cc2b /tests
parenta9985cf172e7cb8ab5c58ce2818752c3572754fc (diff)
downloadrust-4ab75de934935f59f243ab64a641e28aa89e6fcd.tar.gz
rust-4ab75de934935f59f243ab64a641e28aa89e6fcd.zip
Improve diagnostic for missing space in range pattern
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs5
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr16
2 files changed, 9 insertions, 12 deletions
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
index 7ba2b6d857c..30173b1b4be 100644
--- 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
@@ -2,7 +2,8 @@ fn main() {
     let x = 42;
     match x {
         0..=73 => {},
-        74..=> {},   //~ ERROR unexpected `=>` after open range
-                     //~^ ERROR expected one of `=>`, `if`, or `|`, found `>`
+        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
index 9ba6d15113c..cb7f998df7a 100644
--- 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
@@ -1,19 +1,15 @@
-error: unexpected `=>` after open range
-  --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:11
+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: expected one of `=>`, `if`, or `|`, found `>`
-  --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14
-   |
-LL |         74..=> {},
-   |              ^ expected one of `=>`, `if`, or `|`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error