Skip to content

Commit f2bc5b4

Browse files
committed
Merge pull request #833 from pnkfelix/clarify-parsing-in-id-braces
Clarify corner case for parsing `in <place-expr> { <block> }`.
2 parents 85e855b + 6279f55 commit f2bc5b4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

text/0809-box-and-in-for-stdlib.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ tandem with types provided by the stdlib, such as `Box<T>`.
110110
Make `in <place-expr> { <block> }` an overloaded operator that uses
111111
the `<place-expr>` to determine what placement code to run.
112112

113+
Note: when `<place-expr>` is just an identifier,
114+
`<place-expr> { <block> }` is not parsed as a struct literal.
115+
We accomplish this via the same means that is used e.g. for `if` expressions:
116+
we restrict `<place-expr>` to not include struct literals
117+
(see [RFC 92]).
118+
119+
[RFC 92]: https://github.com/rust-lang/rfcs/blob/master/text/0092-struct-grammar.md
120+
113121
* The only stablized implementation for the `box <expr>` operator
114122
proposed by this RFC is `Box<T>`. The question of which other types
115123
should support integration with `box <expr>` is a library design

0 commit comments

Comments
 (0)