Specialize ..
help message for all fields vs. the rest
This commit is contained in:
parent
a5e8e6ec2d
commit
fe82cc38a0
9 changed files with 21 additions and 21 deletions
|
@ -1071,14 +1071,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
if subpats.is_empty() || all_wildcards {
|
||||
err.span_suggestion(
|
||||
all_fields_span,
|
||||
"use `..` to ignore all unmentioned fields",
|
||||
"use `..` to ignore all fields",
|
||||
String::from(".."),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else {
|
||||
err.span_suggestion(
|
||||
after_fields_span,
|
||||
"use `..` to ignore all unmentioned fields",
|
||||
"use `..` to ignore the rest of the fields",
|
||||
String::from(", .."),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | TupleStruct(_, _) = TupleStruct(1, 2);
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | TupleStruct(..) = TupleStruct(1, 2);
|
||||
| ^^
|
||||
|
@ -63,7 +63,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
|
||||
| ^^
|
||||
|
|
|
@ -11,7 +11,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | Fruit::Apple(a, _) => {},
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore the rest of the fields
|
||||
|
|
||||
LL | Fruit::Apple(a, ..) => {},
|
||||
| ^^^^
|
||||
|
|
|
@ -22,7 +22,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | let P(_) = U {};
|
||||
| ^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | let P(..) = U {};
|
||||
| ^^
|
||||
|
|
|
@ -31,7 +31,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | Binder(_a, _x @ .., _) => {}
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore the rest of the fields
|
||||
|
|
||||
LL | Binder(_a, _x @ .., ..) => {}
|
||||
| ^^^^
|
||||
|
|
|
@ -11,7 +11,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | Color::Rgb(_, _, _) => { }
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | Color::Rgb(..) => { }
|
||||
| ^^
|
||||
|
|
|
@ -31,7 +31,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | E::A(x @ .., _) => {
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore the rest of the fields
|
||||
|
|
||||
LL | E::A(x @ .., ..) => {
|
||||
| ^^^^
|
||||
|
|
|
@ -8,38 +8,38 @@ fn main() {
|
|||
S(x) => {}
|
||||
//~^ ERROR this pattern has 1 field, but the corresponding tuple struct has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore the rest of the fields
|
||||
}
|
||||
match S(0, 1.0) {
|
||||
S(_) => {}
|
||||
//~^ ERROR this pattern has 1 field, but the corresponding tuple struct has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore all fields
|
||||
}
|
||||
match S(0, 1.0) {
|
||||
S() => {}
|
||||
//~^ ERROR this pattern has 0 fields, but the corresponding tuple struct has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore all fields
|
||||
}
|
||||
|
||||
match E::S(0, 1.0) {
|
||||
E::S(x) => {}
|
||||
//~^ ERROR this pattern has 1 field, but the corresponding tuple variant has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore the rest of the fields
|
||||
}
|
||||
match E::S(0, 1.0) {
|
||||
E::S(_) => {}
|
||||
//~^ ERROR this pattern has 1 field, but the corresponding tuple variant has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore all fields
|
||||
}
|
||||
match E::S(0, 1.0) {
|
||||
E::S() => {}
|
||||
//~^ ERROR this pattern has 0 fields, but the corresponding tuple variant has 2 fields
|
||||
//~| HELP use `_` to explicitly ignore each field
|
||||
//~| HELP use `..` to ignore all unmentioned fields
|
||||
//~| HELP use `..` to ignore all fields
|
||||
}
|
||||
match E::S(0, 1.0) {
|
||||
E::S => {}
|
||||
|
|
|
@ -20,7 +20,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | S(x, _) => {}
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore the rest of the fields
|
||||
|
|
||||
LL | S(x, ..) => {}
|
||||
| ^^^^
|
||||
|
@ -38,7 +38,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | S(_, _) => {}
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | S(..) => {}
|
||||
| ^^
|
||||
|
@ -56,7 +56,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | S(_, _) => {}
|
||||
| ^^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | S(..) => {}
|
||||
| ^^
|
||||
|
@ -74,7 +74,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | E::S(x, _) => {}
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore the rest of the fields
|
||||
|
|
||||
LL | E::S(x, ..) => {}
|
||||
| ^^^^
|
||||
|
@ -92,7 +92,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | E::S(_, _) => {}
|
||||
| ^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | E::S(..) => {}
|
||||
| ^^
|
||||
|
@ -110,7 +110,7 @@ help: use `_` to explicitly ignore each field
|
|||
|
|
||||
LL | E::S(_, _) => {}
|
||||
| ^^^^
|
||||
help: use `..` to ignore all unmentioned fields
|
||||
help: use `..` to ignore all fields
|
||||
|
|
||||
LL | E::S(..) => {}
|
||||
| ^^
|
||||
|
|
Loading…
Add table
Reference in a new issue