about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2020-12-19 17:48:31 +0000
committerNadrieril <nadrieril+git@gmail.com>2020-12-19 17:48:31 +0000
commit5b6c175566e55e29c0d2c39cb0dab2119ac40c82 (patch)
treeca149ddb039092a3780296979d6df46b08ade629
parent5687c162792db8d267f80de7bd56c319e12efead (diff)
downloadrust-5b6c175566e55e29c0d2c39cb0dab2119ac40c82.tar.gz
rust-5b6c175566e55e29c0d2c39cb0dab2119ac40c82.zip
Tweak diagnostics
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs5
-rw-r--r--src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr16
2 files changed, 10 insertions, 11 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
index 5b1dbabe9a1..94083289cab 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
@@ -309,9 +309,7 @@ impl IntRange {
                 pcx.span,
                 |lint| {
                     let mut err = lint.build("multiple patterns overlap on their endpoints");
-                    err.span_label(pcx.span, "... with this range");
                     for (int_range, span) in overlaps {
-                        // Use the real type for user display of the ranges:
                         err.span_label(
                             span,
                             &format!(
@@ -320,7 +318,8 @@ impl IntRange {
                             ),
                         );
                     }
-                    err.note("this is likely to be a mistake");
+                    err.span_label(pcx.span, "... with this range");
+                    err.note("you likely meant to write mutually exclusive ranges");
                     err.emit();
                 },
             );
diff --git a/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr b/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
index 045c487873a..24c0419e1dd 100644
--- a/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
+++ b/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![deny(overlapping_range_endpoints)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:16:22
@@ -21,7 +21,7 @@ LL |     m!(0u8, 30..=40, 20..=30);
    |             |
    |             this range overlaps on `30_u8`...
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:19:22
@@ -31,7 +31,7 @@ LL |     m!(0u8, 20.. 30, 29..=40);
    |             |
    |             this range overlaps on `29_u8`...
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:23:22
@@ -41,7 +41,7 @@ LL |     m!(0u8, 20..=30, 30..=31);
    |             |
    |             this range overlaps on `30_u8`...
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:27:22
@@ -51,7 +51,7 @@ LL |     m!(0u8, 20..=30, 19..=20);
    |             |
    |             this range overlaps on `20_u8`...
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:39:9
@@ -63,7 +63,7 @@ LL |         20..=30 => {}
 LL |         10..=20 => {}
    |         ^^^^^^^ ... with this range
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:50:16
@@ -73,7 +73,7 @@ LL |         (true, 0..=10) => {}
 LL |         (true, 10..20) => {}
    |                ^^^^^^ ... with this range
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: multiple patterns overlap on their endpoints
   --> $DIR/overlapping_range_endpoints.rs:56:14
@@ -83,7 +83,7 @@ LL |         Some(0..=10) => {}
 LL |         Some(10..20) => {}
    |              ^^^^^^ ... with this range
    |
-   = note: this is likely to be a mistake
+   = note: you likely meant to write mutually exclusive ranges
 
 error: aborting due to 8 previous errors