Skip to content

Commit fe82cc3

Browse files
committed
Specialize .. help message for all fields vs. the rest
1 parent a5e8e6e commit fe82cc3

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

compiler/rustc_typeck/src/check/pat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10711071
if subpats.is_empty() || all_wildcards {
10721072
err.span_suggestion(
10731073
all_fields_span,
1074-
"use `..` to ignore all unmentioned fields",
1074+
"use `..` to ignore all fields",
10751075
String::from(".."),
10761076
Applicability::MaybeIncorrect,
10771077
);
10781078
} else {
10791079
err.span_suggestion(
10801080
after_fields_span,
1081-
"use `..` to ignore all unmentioned fields",
1081+
"use `..` to ignore the rest of the fields",
10821082
String::from(", .."),
10831083
Applicability::MaybeIncorrect,
10841084
);

src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ help: use `_` to explicitly ignore each field
3636
|
3737
LL | TupleStruct(_, _) = TupleStruct(1, 2);
3838
| ^^^
39-
help: use `..` to ignore all unmentioned fields
39+
help: use `..` to ignore all fields
4040
|
4141
LL | TupleStruct(..) = TupleStruct(1, 2);
4242
| ^^
@@ -63,7 +63,7 @@ help: use `_` to explicitly ignore each field
6363
|
6464
LL | Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
6565
| ^^^
66-
help: use `..` to ignore all unmentioned fields
66+
help: use `..` to ignore all fields
6767
|
6868
LL | Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
6969
| ^^

src/test/ui/error-codes/E0023.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ help: use `_` to explicitly ignore each field
1111
|
1212
LL | Fruit::Apple(a, _) => {},
1313
| ^^^
14-
help: use `..` to ignore all unmentioned fields
14+
help: use `..` to ignore the rest of the fields
1515
|
1616
LL | Fruit::Apple(a, ..) => {},
1717
| ^^^^

src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ help: use `_` to explicitly ignore each field
2222
|
2323
LL | let P(_) = U {};
2424
| ^
25-
help: use `..` to ignore all unmentioned fields
25+
help: use `..` to ignore all fields
2626
|
2727
LL | let P(..) = U {};
2828
| ^^

src/test/ui/issues/issue-72574-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ help: use `_` to explicitly ignore each field
3131
|
3232
LL | Binder(_a, _x @ .., _) => {}
3333
| ^^^
34-
help: use `..` to ignore all unmentioned fields
34+
help: use `..` to ignore the rest of the fields
3535
|
3636
LL | Binder(_a, _x @ .., ..) => {}
3737
| ^^^^

src/test/ui/match/match-pattern-field-mismatch.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ help: use `_` to explicitly ignore each field
1111
|
1212
LL | Color::Rgb(_, _, _) => { }
1313
| ^^^
14-
help: use `..` to ignore all unmentioned fields
14+
help: use `..` to ignore all fields
1515
|
1616
LL | Color::Rgb(..) => { }
1717
| ^^

src/test/ui/pattern/issue-74539.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ help: use `_` to explicitly ignore each field
3131
|
3232
LL | E::A(x @ .., _) => {
3333
| ^^^
34-
help: use `..` to ignore all unmentioned fields
34+
help: use `..` to ignore the rest of the fields
3535
|
3636
LL | E::A(x @ .., ..) => {
3737
| ^^^^

src/test/ui/pattern/pat-tuple-underfield.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,38 @@ fn main() {
88
S(x) => {}
99
//~^ ERROR this pattern has 1 field, but the corresponding tuple struct has 2 fields
1010
//~| HELP use `_` to explicitly ignore each field
11-
//~| HELP use `..` to ignore all unmentioned fields
11+
//~| HELP use `..` to ignore the rest of the fields
1212
}
1313
match S(0, 1.0) {
1414
S(_) => {}
1515
//~^ ERROR this pattern has 1 field, but the corresponding tuple struct has 2 fields
1616
//~| HELP use `_` to explicitly ignore each field
17-
//~| HELP use `..` to ignore all unmentioned fields
17+
//~| HELP use `..` to ignore all fields
1818
}
1919
match S(0, 1.0) {
2020
S() => {}
2121
//~^ ERROR this pattern has 0 fields, but the corresponding tuple struct has 2 fields
2222
//~| HELP use `_` to explicitly ignore each field
23-
//~| HELP use `..` to ignore all unmentioned fields
23+
//~| HELP use `..` to ignore all fields
2424
}
2525

2626
match E::S(0, 1.0) {
2727
E::S(x) => {}
2828
//~^ ERROR this pattern has 1 field, but the corresponding tuple variant has 2 fields
2929
//~| HELP use `_` to explicitly ignore each field
30-
//~| HELP use `..` to ignore all unmentioned fields
30+
//~| HELP use `..` to ignore the rest of the fields
3131
}
3232
match E::S(0, 1.0) {
3333
E::S(_) => {}
3434
//~^ ERROR this pattern has 1 field, but the corresponding tuple variant has 2 fields
3535
//~| HELP use `_` to explicitly ignore each field
36-
//~| HELP use `..` to ignore all unmentioned fields
36+
//~| HELP use `..` to ignore all fields
3737
}
3838
match E::S(0, 1.0) {
3939
E::S() => {}
4040
//~^ ERROR this pattern has 0 fields, but the corresponding tuple variant has 2 fields
4141
//~| HELP use `_` to explicitly ignore each field
42-
//~| HELP use `..` to ignore all unmentioned fields
42+
//~| HELP use `..` to ignore all fields
4343
}
4444
match E::S(0, 1.0) {
4545
E::S => {}

src/test/ui/pattern/pat-tuple-underfield.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ help: use `_` to explicitly ignore each field
2020
|
2121
LL | S(x, _) => {}
2222
| ^^^
23-
help: use `..` to ignore all unmentioned fields
23+
help: use `..` to ignore the rest of the fields
2424
|
2525
LL | S(x, ..) => {}
2626
| ^^^^
@@ -38,7 +38,7 @@ help: use `_` to explicitly ignore each field
3838
|
3939
LL | S(_, _) => {}
4040
| ^^^
41-
help: use `..` to ignore all unmentioned fields
41+
help: use `..` to ignore all fields
4242
|
4343
LL | S(..) => {}
4444
| ^^
@@ -56,7 +56,7 @@ help: use `_` to explicitly ignore each field
5656
|
5757
LL | S(_, _) => {}
5858
| ^^^^
59-
help: use `..` to ignore all unmentioned fields
59+
help: use `..` to ignore all fields
6060
|
6161
LL | S(..) => {}
6262
| ^^
@@ -74,7 +74,7 @@ help: use `_` to explicitly ignore each field
7474
|
7575
LL | E::S(x, _) => {}
7676
| ^^^
77-
help: use `..` to ignore all unmentioned fields
77+
help: use `..` to ignore the rest of the fields
7878
|
7979
LL | E::S(x, ..) => {}
8080
| ^^^^
@@ -92,7 +92,7 @@ help: use `_` to explicitly ignore each field
9292
|
9393
LL | E::S(_, _) => {}
9494
| ^^^
95-
help: use `..` to ignore all unmentioned fields
95+
help: use `..` to ignore all fields
9696
|
9797
LL | E::S(..) => {}
9898
| ^^
@@ -110,7 +110,7 @@ help: use `_` to explicitly ignore each field
110110
|
111111
LL | E::S(_, _) => {}
112112
| ^^^^
113-
help: use `..` to ignore all unmentioned fields
113+
help: use `..` to ignore all fields
114114
|
115115
LL | E::S(..) => {}
116116
| ^^

0 commit comments

Comments
 (0)