File tree Expand file tree Collapse file tree 3 files changed +8
-17
lines changed Expand file tree Collapse file tree 3 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -153,9 +153,10 @@ impl AssocOp {
153153 match * self {
154154 Assign | AssignOp ( _) => Fixity :: Right ,
155155 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+ }
159160 }
160161 }
161162
Original file line number Diff line number Diff line change @@ -279,13 +279,9 @@ impl<'a> Parser<'a> {
279279 break ;
280280 }
281281
282- let fixity = op. fixity ( ) ;
283- let min_prec = match fixity {
282+ let min_prec = match op. fixity ( ) {
284283 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) ,
289285 } ;
290286 let ( rhs, _) = self . with_res ( restrictions - Restrictions :: STMT_EXPR , |this| {
291287 let attrs = this. parse_outer_attributes ( ) ?;
@@ -337,10 +333,6 @@ impl<'a> Parser<'a> {
337333 self . dcx ( ) . span_bug ( span, "AssocOp should have been handled by special case" )
338334 }
339335 } ;
340-
341- if let Fixity :: None = fixity {
342- break ;
343- }
344336 }
345337
346338 Ok ( ( lhs, parsed_something) )
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ static EXPRS: &[&str] = &[
9797 "2..(2..2)" ,
9898 "(2..2).." ,
9999 "..(2..2)" ,
100+ // Grammar restriction: comparison operators cannot be chained (1 < 2 == false).
101+ "((1 < 2) == false) as usize" ,
100102 // Grammar restriction: the value in let-else is not allowed to end in a
101103 // curly brace.
102104 "{ let _ = 1 + 1 else {}; }" ,
@@ -121,10 +123,6 @@ static EXPRS: &[&str] = &[
121123 "if let _ = () && (Struct {}).x {}",
122124 */
123125 /*
124- // FIXME: pretty-printer produces invalid syntax. `(1 < 2 == false) as usize`
125- "((1 < 2) == false) as usize",
126- */
127- /*
128126 // FIXME: pretty-printer produces invalid syntax. `for _ in 1..{ 2 } {}`
129127 "for _ in (1..{ 2 }) {}",
130128 */
You can’t perform that action at this time.
0 commit comments