improve non-exhaustive struct pat error
This commit is contained in:
parent
58fee523cf
commit
bd156846fa
3 changed files with 49 additions and 8 deletions
|
|
@ -62,18 +62,33 @@ error[E0638]: `..` required with struct marked as non-exhaustive
|
|||
|
|
||||
LL | let NormalStruct { first_field, second_field } = ns;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `..` at the end of the field list
|
||||
|
|
||||
LL | let NormalStruct { first_field, second_field , .. } = ns;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0638]: `..` required with struct marked as non-exhaustive
|
||||
--> $DIR/struct.rs:26:9
|
||||
|
|
||||
LL | let TupleStruct { 0: first_field, 1: second_field } = ts;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `..` at the end of the field list
|
||||
|
|
||||
LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0638]: `..` required with struct marked as non-exhaustive
|
||||
--> $DIR/struct.rs:35:9
|
||||
|
|
||||
LL | let UnitStruct { } = us;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `..` at the end of the field list
|
||||
|
|
||||
LL | let UnitStruct { .. } = us;
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,22 @@ error[E0638]: `..` required with variant marked as non-exhaustive
|
|||
|
|
||||
LL | NonExhaustiveVariants::Struct { field } => ""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `..` at the end of the field list
|
||||
|
|
||||
LL | NonExhaustiveVariants::Struct { field , .. } => ""
|
||||
| ^^^^^^
|
||||
|
||||
error[E0638]: `..` required with variant marked as non-exhaustive
|
||||
--> $DIR/variant.rs:30:12
|
||||
|
|
||||
LL | if let NonExhaustiveVariants::Struct { field } = variant_struct {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `..` at the end of the field list
|
||||
|
|
||||
LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct {
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue