@@ -53,8 +53,6 @@ pub enum AssocOp {
5353 DotDot ,
5454 /// `..=` range
5555 DotDotEq ,
56- /// `:`
57- Colon ,
5856}
5957
6058#[ derive( PartialEq , Debug ) ]
@@ -96,7 +94,6 @@ impl AssocOp {
9694 token:: DotDotEq => Some ( DotDotEq ) ,
9795 // DotDotDot is no longer supported, but we need some way to display the error
9896 token:: DotDotDot => Some ( DotDotEq ) ,
99- token:: Colon => Some ( Colon ) ,
10097 // `<-` should probably be `< -`
10198 token:: LArrow => Some ( Less ) ,
10299 _ if t. is_keyword ( kw:: As ) => Some ( As ) ,
@@ -133,7 +130,7 @@ impl AssocOp {
133130 pub fn precedence ( & self ) -> usize {
134131 use AssocOp :: * ;
135132 match * self {
136- As | Colon => 14 ,
133+ As => 14 ,
137134 Multiply | Divide | Modulus => 13 ,
138135 Add | Subtract => 12 ,
139136 ShiftLeft | ShiftRight => 11 ,
@@ -156,7 +153,7 @@ impl AssocOp {
156153 Assign | AssignOp ( _) => Fixity :: Right ,
157154 As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd
158155 | BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual
159- | LAnd | LOr | Colon => Fixity :: Left ,
156+ | LAnd | LOr => Fixity :: Left ,
160157 DotDot | DotDotEq => Fixity :: None ,
161158 }
162159 }
@@ -166,8 +163,9 @@ impl AssocOp {
166163 match * self {
167164 Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true ,
168165 Assign | AssignOp ( _) | As | Multiply | Divide | Modulus | Add | Subtract
169- | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq
170- | Colon => false ,
166+ | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq => {
167+ false
168+ }
171169 }
172170 }
173171
@@ -177,7 +175,7 @@ impl AssocOp {
177175 Assign | AssignOp ( _) => true ,
178176 Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply
179177 | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor
180- | BitOr | LAnd | LOr | DotDot | DotDotEq | Colon => false ,
178+ | BitOr | LAnd | LOr | DotDot | DotDotEq => false ,
181179 }
182180 }
183181
@@ -202,7 +200,7 @@ impl AssocOp {
202200 BitOr => Some ( BinOpKind :: BitOr ) ,
203201 LAnd => Some ( BinOpKind :: And ) ,
204202 LOr => Some ( BinOpKind :: Or ) ,
205- Assign | AssignOp ( _) | As | DotDot | DotDotEq | Colon => None ,
203+ Assign | AssignOp ( _) | As | DotDot | DotDotEq => None ,
206204 }
207205 }
208206
@@ -223,10 +221,9 @@ impl AssocOp {
223221 Greater | // `{ 42 } > 3`
224222 GreaterEqual | // `{ 42 } >= 3`
225223 AssignOp ( _) | // `{ 42 } +=`
226- As | // `{ 42 } as usize`
227224 // Equal | // `{ 42 } == { 42 }` Accepting these here would regress incorrect
228- // NotEqual | // `{ 42 } != { 42 }` struct literals parser recovery.
229- Colon , // `{ 42 }: usize`
225+ // NotEqual | // `{ 42 } != { 42 } struct literals parser recovery.
226+ As // `{ 42 } as usize`
230227 )
231228 }
232229}
@@ -254,7 +251,6 @@ pub enum ExprPrecedence {
254251 Binary ( BinOpKind ) ,
255252
256253 Cast ,
257- Type ,
258254
259255 Assign ,
260256 AssignOp ,
@@ -313,7 +309,6 @@ impl ExprPrecedence {
313309 // Binop-like expr kinds, handled by `AssocOp`.
314310 ExprPrecedence :: Binary ( op) => AssocOp :: from_ast_binop ( op) . precedence ( ) as i8 ,
315311 ExprPrecedence :: Cast => AssocOp :: As . precedence ( ) as i8 ,
316- ExprPrecedence :: Type => AssocOp :: Colon . precedence ( ) as i8 ,
317312
318313 ExprPrecedence :: Assign |
319314 ExprPrecedence :: AssignOp => AssocOp :: Assign . precedence ( ) as i8 ,
0 commit comments