Skip to content

Commit

Permalink
Merge pull request rust-lang#135 from brauliobz/grammar_closure_expr
Browse files Browse the repository at this point in the history
Closures grammar
  • Loading branch information
Havvy authored Dec 1, 2017
2 parents d197813 + 7a0d98e commit 98bd568
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/expressions/closure-expr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Closure expressions

> **<sup>Syntax</sup>**
> _ClosureExpression_ :
> &nbsp;&nbsp; `move`<sup>?</sup>
> &nbsp;&nbsp; ( `||` | `|` [_FunctionParameters_]<sup>?</sup> `|` )
> &nbsp;&nbsp; ([_Expression_] | `->` [_TypeNoBounds_]&nbsp;[_BlockExpression_])
A _closure expression_ defines a closure and denotes it as a value, in a single
expression. A closure expression is a pipe-symbol-delimited (`|`) list of
patterns followed by an expression. Type annotations may optionally be added
Expand Down Expand Up @@ -56,3 +62,8 @@ ten_times(move |j| println!("{}, {}", word, j));

[block]: expressions/block-expr.html
[function definitions]: items/functions.html

[_Expression_]: expressions.html
[_BlockExpression_]: expressions/block-expr.html
[_TypeNoBounds_]: types.html
[_FunctionParameters_]: items/functions.html

0 comments on commit 98bd568

Please sign in to comment.