Skip to content

Commit

Permalink
Mention a solution for eRFC 2947 ambiguity.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtwco committed Oct 3, 2018
1 parent 165c11a commit 9f758ac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/expressions/if-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ match EXPR {
The expression cannot be a [lazy boolean operator expression][_LazyBooleanOperatorExpression_].
Use of a lazy boolean operator is ambiguous with a planned feature change
of the language (the implementation of if-let chains - see [eRFC 2947][_eRFCIfLetChain_]).
When lazy boolean operator expression is desired, this can be achieved
by using parenthesis as below:

```rust,ignore
// Before...
if let PAT = EXPR && EXPR { .. }
// After...
if let PAT = ( EXPR && EXPR ) { .. }
// Before...
if let PAT = EXPR || EXPR { .. }
// After...
if let PAT = ( EXPR || EXPR ) { .. }
```

[_Expression_]: expressions.html
[_BlockExpression_]: expressions/block-expr.html
Expand Down

0 comments on commit 9f758ac

Please sign in to comment.