diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-13 08:27:53 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-13 08:27:53 +0900 |
| commit | 302cf6db74102e0a0438d83ec7f68085cf931bb9 (patch) | |
| tree | ce79f635fe28df6a476408cc4f43c1b20ca17c1f /src/test/ui/error-codes | |
| parent | 5dda3ee9314cfee9c4e30a7b17dcd5ebdec081a7 (diff) | |
| download | rust-302cf6db74102e0a0438d83ec7f68085cf931bb9.tar.gz rust-302cf6db74102e0a0438d83ec7f68085cf931bb9.zip | |
Tweak non-char/numeric in range pattern diagnostic
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0029-teach.stderr | 7 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0029.stderr | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/test/ui/error-codes/E0029-teach.stderr b/src/test/ui/error-codes/E0029-teach.stderr index 998ef4bc1d7..ec146ca86f5 100644 --- a/src/test/ui/error-codes/E0029-teach.stderr +++ b/src/test/ui/error-codes/E0029-teach.stderr @@ -2,10 +2,11 @@ error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/E0029-teach.rs:7:9 | LL | "hello" ..= "world" => {} - | ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types + | -------^^^^^------- + | | | + | | this is of type `&'static str` but it should be `char` or numeric + | this is of type `&'static str` but it should be `char` or numeric | - = note: start type: &'static str - = note: end type: &'static str = note: In a match expression, only numbers and characters can be matched against a range. This is because the compiler checks that the range is non-empty at compile-time, and is unable to evaluate arbitrary comparison functions. If you want to capture values of an orderable type between two end-points, you can use a guard. error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0029.stderr b/src/test/ui/error-codes/E0029.stderr index 209d219191c..e54722ae7b9 100644 --- a/src/test/ui/error-codes/E0029.stderr +++ b/src/test/ui/error-codes/E0029.stderr @@ -2,10 +2,10 @@ error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/E0029.rs:5:9 | LL | "hello" ..= "world" => {} - | ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types - | - = note: start type: &'static str - = note: end type: &'static str + | -------^^^^^------- + | | | + | | this is of type `&'static str` but it should be `char` or numeric + | this is of type `&'static str` but it should be `char` or numeric error: aborting due to previous error |
