File tree Expand file tree Collapse file tree 1 file changed +33
-4
lines changed Expand file tree Collapse file tree 1 file changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,39 @@ the enum.
73
73
"## ,
74
74
75
75
E0025 : r##"
76
- Each field of a struct can only be bound once in a pattern. Each occurrence of a
77
- field name binds the value of that field, so to fix this error you will have to
78
- remove or alter the duplicate uses of the field name. Perhaps you misspelt
79
- another field name?
76
+ Each field of a struct can only be bound once in a pattern. Erroneous code
77
+ example:
78
+
79
+ ```
80
+ struct Foo {
81
+ a: u8,
82
+ b: u8,
83
+ }
84
+
85
+ fn main(){
86
+ let x = Foo { a:1, b:2 };
87
+
88
+ let Foo { a: x, a: y } = x;
89
+ // error: field `a` bound multiple times in the pattern
90
+ }
91
+ ```
92
+
93
+ Each occurrence of a field name binds the value of that field, so to fix this
94
+ error you will have to remove or alter the duplicate uses of the field name.
95
+ Perhaps you misspelled another field name? Example:
96
+
97
+ ```
98
+ struct Foo {
99
+ a: u8,
100
+ b: u8,
101
+ }
102
+
103
+ fn main(){
104
+ let x = Foo { a:1, b:2 };
105
+
106
+ let Foo { a: x, b: y } = x; // ok!
107
+ }
108
+ ```
80
109
"## ,
81
110
82
111
E0026 : r##"
You can’t perform that action at this time.
0 commit comments