diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-06-13 19:09:12 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-06-23 15:39:29 -0700 |
| commit | 654d6444feafaa7bae17057d8b98823c7556ea14 (patch) | |
| tree | 423bbab4e54f324b269942c6af7b1c01a1eeaa36 /src/doc/rust.md | |
| parent | 575710f6cee318e2806b4563eb2887c1f03aaa18 (diff) | |
| download | rust-654d6444feafaa7bae17057d8b98823c7556ea14.tar.gz rust-654d6444feafaa7bae17057d8b98823c7556ea14.zip | |
libsyntax: Disallow struct literals after `if`, `while`, `match`, and
`for...in`. Closes #14803. If you used a structure literal after one of these keywords, surround it in parentheses. [breaking-change]
Diffstat (limited to 'src/doc/rust.md')
| -rw-r--r-- | src/doc/rust.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md index e7b6941b622..28ccea5ad17 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -3004,7 +3004,7 @@ ten_times(|j| println!("hello, {}", j)); ### While loops ~~~~ {.ebnf .gram} -while_expr : "while" expr '{' block '}' ; +while_expr : "while" no_struct_literal_expr '{' block '}' ; ~~~~ A `while` loop begins by evaluating the boolean loop conditional expression. @@ -3071,7 +3071,7 @@ A `continue` expression is only permitted in the body of a loop. ### For expressions ~~~~ {.ebnf .gram} -for_expr : "for" pat "in" expr '{' block '}' ; +for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ; ~~~~ A `for` expression is a syntactic construct for looping over elements @@ -3105,7 +3105,7 @@ for i in range(0u, 256) { ### If expressions ~~~~ {.ebnf .gram} -if_expr : "if" expr '{' block '}' +if_expr : "if" no_struct_literal_expr '{' block '}' else_tail ? ; else_tail : "else" [ if_expr @@ -3126,7 +3126,7 @@ then any `else` block is executed. ### Match expressions ~~~~ {.ebnf .gram} -match_expr : "match" expr '{' match_arm * '}' ; +match_expr : "match" no_struct_literal_expr '{' match_arm * '}' ; match_arm : attribute * match_pat "=>" [ expr "," | '{' block '}' ] ; |
