@@ -56,6 +56,8 @@ pub enum AssocOp {
5656 GreaterEqual ,
5757 /// `=`
5858 Assign ,
59+ /// `<-`
60+ ObsoleteInPlace ,
5961 /// `?=` where ? is one of the BinOpToken
6062 AssignOp ( BinOpToken ) ,
6163 /// `as`
@@ -84,6 +86,7 @@ impl AssocOp {
8486 use self :: AssocOp :: * ;
8587 match * t {
8688 Token :: BinOpEq ( k) => Some ( AssignOp ( k) ) ,
89+ Token :: LArrow => Some ( ObsoleteInPlace ) ,
8790 Token :: Eq => Some ( Assign ) ,
8891 Token :: BinOp ( BinOpToken :: Star ) => Some ( Multiply ) ,
8992 Token :: BinOp ( BinOpToken :: Slash ) => Some ( Divide ) ,
@@ -153,6 +156,7 @@ impl AssocOp {
153156 LAnd => 6 ,
154157 LOr => 5 ,
155158 DotDot | DotDotEq => 4 ,
159+ ObsoleteInPlace => 3 ,
156160 Assign | AssignOp ( _) => 2 ,
157161 }
158162 }
@@ -162,7 +166,7 @@ impl AssocOp {
162166 use self :: AssocOp :: * ;
163167 // NOTE: it is a bug to have an operators that has same precedence but different fixities!
164168 match * self {
165- Assign | AssignOp ( _) => Fixity :: Right ,
169+ ObsoleteInPlace | Assign | AssignOp ( _) => Fixity :: Right ,
166170 As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd |
167171 BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual |
168172 LAnd | LOr | Colon => Fixity :: Left ,
@@ -174,16 +178,16 @@ impl AssocOp {
174178 use self :: AssocOp :: * ;
175179 match * self {
176180 Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true ,
177- Assign | AssignOp ( _) | As | Multiply | Divide | Modulus | Add | Subtract |
178- ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr |
181+ ObsoleteInPlace | Assign | AssignOp ( _) | As | Multiply | Divide | Modulus | Add |
182+ Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr |
179183 DotDot | DotDotEq | Colon => false
180184 }
181185 }
182186
183187 pub fn is_assign_like ( & self ) -> bool {
184188 use self :: AssocOp :: * ;
185189 match * self {
186- Assign | AssignOp ( _) => true ,
190+ Assign | AssignOp ( _) | ObsoleteInPlace => true ,
187191 Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply | Divide |
188192 Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd |
189193 LOr | DotDot | DotDotEq | Colon => false
@@ -211,7 +215,7 @@ impl AssocOp {
211215 BitOr => Some ( BinOpKind :: BitOr ) ,
212216 LAnd => Some ( BinOpKind :: And ) ,
213217 LOr => Some ( BinOpKind :: Or ) ,
214- Assign | AssignOp ( _) | As | DotDot | DotDotEq | Colon => None
218+ ObsoleteInPlace | Assign | AssignOp ( _) | As | DotDot | DotDotEq | Colon => None
215219 }
216220 }
217221}
@@ -238,6 +242,7 @@ pub enum ExprPrecedence {
238242
239243 Binary ( BinOpKind ) ,
240244
245+ ObsoleteInPlace ,
241246 Cast ,
242247 Type ,
243248
@@ -304,6 +309,7 @@ impl ExprPrecedence {
304309
305310 // Binop-like expr kinds, handled by `AssocOp`.
306311 ExprPrecedence :: Binary ( op) => AssocOp :: from_ast_binop ( op) . precedence ( ) as i8 ,
312+ ExprPrecedence :: ObsoleteInPlace => AssocOp :: ObsoleteInPlace . precedence ( ) as i8 ,
307313 ExprPrecedence :: Cast => AssocOp :: As . precedence ( ) as i8 ,
308314 ExprPrecedence :: Type => AssocOp :: Colon . precedence ( ) as i8 ,
309315
0 commit comments