File tree 3 files changed +8
-17
lines changed
3 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -153,9 +153,10 @@ impl AssocOp {
153
153
match * self {
154
154
Assign | AssignOp ( _) => Fixity :: Right ,
155
155
As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd
156
- | BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual
157
- | LAnd | LOr => Fixity :: Left ,
158
- DotDot | DotDotEq => Fixity :: None ,
156
+ | BitXor | BitOr | LAnd | LOr => Fixity :: Left ,
157
+ Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | DotDot | DotDotEq => {
158
+ Fixity :: None
159
+ }
159
160
}
160
161
}
161
162
Original file line number Diff line number Diff line change @@ -279,13 +279,9 @@ impl<'a> Parser<'a> {
279
279
break ;
280
280
}
281
281
282
- let fixity = op. fixity ( ) ;
283
- let min_prec = match fixity {
282
+ let min_prec = match op. fixity ( ) {
284
283
Fixity :: Right => Bound :: Included ( prec) ,
285
- Fixity :: Left => Bound :: Excluded ( prec) ,
286
- // We currently have no non-associative operators that are not handled above by
287
- // the special cases. The code is here only for future convenience.
288
- Fixity :: None => Bound :: Excluded ( prec) ,
284
+ Fixity :: Left | Fixity :: None => Bound :: Excluded ( prec) ,
289
285
} ;
290
286
let ( rhs, _) = self . with_res ( restrictions - Restrictions :: STMT_EXPR , |this| {
291
287
let attrs = this. parse_outer_attributes ( ) ?;
@@ -337,10 +333,6 @@ impl<'a> Parser<'a> {
337
333
self . dcx ( ) . span_bug ( span, "AssocOp should have been handled by special case" )
338
334
}
339
335
} ;
340
-
341
- if let Fixity :: None = fixity {
342
- break ;
343
- }
344
336
}
345
337
346
338
Ok ( ( lhs, parsed_something) )
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ static EXPRS: &[&str] = &[
97
97
"2..(2..2)" ,
98
98
"(2..2).." ,
99
99
"..(2..2)" ,
100
+ // Grammar restriction: comparison operators cannot be chained (1 < 2 == false).
101
+ "((1 < 2) == false) as usize" ,
100
102
// Grammar restriction: the value in let-else is not allowed to end in a
101
103
// curly brace.
102
104
"{ let _ = 1 + 1 else {}; }" ,
@@ -121,10 +123,6 @@ static EXPRS: &[&str] = &[
121
123
"if let _ = () && (Struct {}).x {}",
122
124
*/
123
125
/*
124
- // FIXME: pretty-printer produces invalid syntax. `(1 < 2 == false) as usize`
125
- "((1 < 2) == false) as usize",
126
- */
127
- /*
128
126
// FIXME: pretty-printer produces invalid syntax. `for _ in 1..{ 2 } {}`
129
127
"for _ in (1..{ 2 }) {}",
130
128
*/
You can’t perform that action at this time.
0 commit comments