Skip to content

Commit 5b6c175

Browse files
committed
Tweak diagnostics
1 parent 5687c16 commit 5b6c175

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,7 @@ impl IntRange {
309309
pcx.span,
310310
|lint| {
311311
let mut err = lint.build("multiple patterns overlap on their endpoints");
312-
err.span_label(pcx.span, "... with this range");
313312
for (int_range, span) in overlaps {
314-
// Use the real type for user display of the ranges:
315313
err.span_label(
316314
span,
317315
&format!(
@@ -320,7 +318,8 @@ impl IntRange {
320318
),
321319
);
322320
}
323-
err.note("this is likely to be a mistake");
321+
err.span_label(pcx.span, "... with this range");
322+
err.note("you likely meant to write mutually exclusive ranges");
324323
err.emit();
325324
},
326325
);

src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: the lint level is defined here
1111
|
1212
LL | #![deny(overlapping_range_endpoints)]
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
= note: this is likely to be a mistake
14+
= note: you likely meant to write mutually exclusive ranges
1515

1616
error: multiple patterns overlap on their endpoints
1717
--> $DIR/overlapping_range_endpoints.rs:16:22
@@ -21,7 +21,7 @@ LL | m!(0u8, 30..=40, 20..=30);
2121
| |
2222
| this range overlaps on `30_u8`...
2323
|
24-
= note: this is likely to be a mistake
24+
= note: you likely meant to write mutually exclusive ranges
2525

2626
error: multiple patterns overlap on their endpoints
2727
--> $DIR/overlapping_range_endpoints.rs:19:22
@@ -31,7 +31,7 @@ LL | m!(0u8, 20.. 30, 29..=40);
3131
| |
3232
| this range overlaps on `29_u8`...
3333
|
34-
= note: this is likely to be a mistake
34+
= note: you likely meant to write mutually exclusive ranges
3535

3636
error: multiple patterns overlap on their endpoints
3737
--> $DIR/overlapping_range_endpoints.rs:23:22
@@ -41,7 +41,7 @@ LL | m!(0u8, 20..=30, 30..=31);
4141
| |
4242
| this range overlaps on `30_u8`...
4343
|
44-
= note: this is likely to be a mistake
44+
= note: you likely meant to write mutually exclusive ranges
4545

4646
error: multiple patterns overlap on their endpoints
4747
--> $DIR/overlapping_range_endpoints.rs:27:22
@@ -51,7 +51,7 @@ LL | m!(0u8, 20..=30, 19..=20);
5151
| |
5252
| this range overlaps on `20_u8`...
5353
|
54-
= note: this is likely to be a mistake
54+
= note: you likely meant to write mutually exclusive ranges
5555

5656
error: multiple patterns overlap on their endpoints
5757
--> $DIR/overlapping_range_endpoints.rs:39:9
@@ -63,7 +63,7 @@ LL | 20..=30 => {}
6363
LL | 10..=20 => {}
6464
| ^^^^^^^ ... with this range
6565
|
66-
= note: this is likely to be a mistake
66+
= note: you likely meant to write mutually exclusive ranges
6767

6868
error: multiple patterns overlap on their endpoints
6969
--> $DIR/overlapping_range_endpoints.rs:50:16
@@ -73,7 +73,7 @@ LL | (true, 0..=10) => {}
7373
LL | (true, 10..20) => {}
7474
| ^^^^^^ ... with this range
7575
|
76-
= note: this is likely to be a mistake
76+
= note: you likely meant to write mutually exclusive ranges
7777

7878
error: multiple patterns overlap on their endpoints
7979
--> $DIR/overlapping_range_endpoints.rs:56:14
@@ -83,7 +83,7 @@ LL | Some(0..=10) => {}
8383
LL | Some(10..20) => {}
8484
| ^^^^^^ ... with this range
8585
|
86-
= note: this is likely to be a mistake
86+
= note: you likely meant to write mutually exclusive ranges
8787

8888
error: aborting due to 8 previous errors
8989

0 commit comments

Comments
 (0)