Skip to content

Commit

Permalink
Tweak diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Dec 19, 2020
1 parent 5687c16 commit 5b6c175
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
Expand Up @@ -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!(
Expand All @@ -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();
},
);
Expand Down
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 5b6c175

Please sign in to comment.