@@ -45,7 +45,7 @@ have type compatible with the value of the `break` expression(s).
45
45
46
46
> ** <sup >Syntax</sup >** \
47
47
> _ PredicateLoopExpression_ :\
48
- >   ;  ; ` while ` [ _ Expression_ ] <sub >except struct expression </sub > [ _ BlockExpression_ ]
48
+ >   ;  ; ` while ` [ _ Expression_ ] <sub >_ except struct expression _ </sub > [ _ BlockExpression_ ]
49
49
50
50
A ` while ` loop begins by evaluating the boolean loop conditional expression. If
51
51
the loop conditional expression evaluates to ` true ` , the loop body block
@@ -67,7 +67,7 @@ while i < 10 {
67
67
68
68
> ** <sup >Syntax</sup >** \
69
69
> [ _ PredicatePatternLoopExpression_ ] :\
70
- >   ;  ; ` while ` ` let ` [ _ MatchArmPatterns_ ] ` = ` [ _ Expression_ ] <sub >except struct expression </sub >
70
+ >   ;  ; ` while ` ` let ` [ _ MatchArmPatterns_ ] ` = ` [ _ Expression_ ] <sub >_ except struct or lazy boolean operator expression _ </sub >
71
71
> [ _ BlockExpression_ ]
72
72
73
73
A ` while let ` loop is semantically similar to a ` while ` loop but in place of a
@@ -123,11 +123,32 @@ while let Some(v @ 1) | Some(v @ 2) = vals.pop() {
123
123
}
124
124
```
125
125
126
+ The expression cannot be a [ lazy boolean operator expression] [ _LazyBooleanOperatorExpression_ ] .
127
+ Use of a lazy boolean operator is ambiguous with a planned feature change
128
+ of the language (the implementation of if-let chains - see [ eRFC 2947] [ _eRFCIfLetChain_ ] ).
129
+ When lazy boolean operator expression is desired, this can be achieved
130
+ by using parenthesis as below:
131
+
132
+ <!-- ignore: psuedo code -->
133
+ ``` rust,ignore
134
+ // Before...
135
+ while let PAT = EXPR && EXPR { .. }
136
+
137
+ // After...
138
+ while let PAT = ( EXPR && EXPR ) { .. }
139
+
140
+ // Before...
141
+ while let PAT = EXPR || EXPR { .. }
142
+
143
+ // After...
144
+ while let PAT = ( EXPR || EXPR ) { .. }
145
+ ```
146
+
126
147
## Iterator loops
127
148
128
149
> ** <sup >Syntax</sup >** \
129
150
> _ IteratorLoopExpression_ :\
130
- >   ;  ; ` for ` [ _ Pattern_ ] ` in ` [ _ Expression_ ] <sub >except struct expression </sub >
151
+ >   ;  ; ` for ` [ _ Pattern_ ] ` in ` [ _ Expression_ ] <sub >_ except struct expression _ </sub >
131
152
> [ _ BlockExpression_ ]
132
153
133
154
A ` for ` expression is a syntactic construct for looping over elements provided
0 commit comments