Skip to content

Commit 7016ba9

Browse files
committed
Add description of formal grammar change
1 parent 23b9194 commit 7016ba9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

text/0000-named-field-puns.md

+10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ In the initializer for a `struct` with named fields, a `union` with named
6868
fields, or an enum variant with named fields, accept an identifier `field` as a
6969
shorthand for `field: field`.
7070

71+
With reference to the grammar in `parser-lalr.y`, this proposal would
72+
expand the `field_init`
73+
[rule](https://github.com/rust-lang/rust/blob/master/src/grammar/parser-lalr.y#L1663-L1665)
74+
to the following:
75+
76+
field_init
77+
: ident
78+
| ident ':' expr
79+
;
80+
7181
## Interpretation
7282

7383
The shorthand initializer `field` always behaves in every possible way like the

0 commit comments

Comments
 (0)