File tree Expand file tree Collapse file tree
compiler/rustc_parse/src/parser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1628,8 +1628,7 @@ impl<'a> Parser<'a> {
16281628 let first_expr = self . parse_expr ( ) ?;
16291629 if self . eat ( exp ! ( Semi ) ) {
16301630 // Repeating array syntax: `[ 0; 512 ]`
1631- let count =
1632- self . parse_expr_anon_const ( |this, expr| this. mgca_direct_lit_hack ( expr) ) ?;
1631+ let count = self . parse_expr_anon_const ( |_, _| MgcaDisambiguation :: Direct ) ?;
16331632 self . expect ( close) ?;
16341633 ExprKind :: Repeat ( first_expr, count)
16351634 } else if self . eat ( exp ! ( Comma ) ) {
Original file line number Diff line number Diff line change @@ -1587,9 +1587,7 @@ impl<'a> Parser<'a> {
15871587
15881588 let rhs = match ( self . eat ( exp ! ( Eq ) ) , const_arg) {
15891589 ( true , true ) => ConstItemRhsKind :: TypeConst {
1590- rhs : Some (
1591- self . parse_expr_anon_const ( |this, expr| this. mgca_direct_lit_hack ( expr) ) ?,
1592- ) ,
1590+ rhs : Some ( self . parse_expr_anon_const ( |_, _| MgcaDisambiguation :: Direct ) ?) ,
15931591 } ,
15941592 ( true , false ) => ConstItemRhsKind :: Body { rhs : Some ( self . parse_expr ( ) ?) } ,
15951593 ( false , true ) => ConstItemRhsKind :: TypeConst { rhs : None } ,
Original file line number Diff line number Diff line change @@ -915,14 +915,7 @@ impl<'a> Parser<'a> {
915915 } ) ;
916916 }
917917
918- let mgca_disambiguation = self . mgca_direct_lit_hack ( & expr) ;
919- Ok ( ( expr, mgca_disambiguation) )
920- }
921-
922- /// Under `min_generic_const_args`, prefer direct const arguments rather than
923- /// wrapping literals in anon consts.
924- pub fn mgca_direct_lit_hack ( & self , _expr : & Expr ) -> MgcaDisambiguation {
925- MgcaDisambiguation :: Direct
918+ Ok ( ( expr, MgcaDisambiguation :: Direct ) )
926919 }
927920
928921 /// Parse a generic argument in a path segment.
Original file line number Diff line number Diff line change @@ -658,8 +658,7 @@ impl<'a> Parser<'a> {
658658 } ;
659659
660660 let ty = if self . eat ( exp ! ( Semi ) ) {
661- let mut length =
662- self . parse_expr_anon_const ( |this, expr| this. mgca_direct_lit_hack ( expr) ) ?;
661+ let mut length = self . parse_expr_anon_const ( |_, _| MgcaDisambiguation :: Direct ) ?;
663662
664663 if let Err ( e) = self . expect ( exp ! ( CloseBracket ) ) {
665664 // Try to recover from `X<Y, ...>` when `X::<Y, ...>` works
You can’t perform that action at this time.
0 commit comments