@@ -20,9 +20,9 @@ use crate::errors::{
2020 InvalidNumLiteralSuffix , LabeledLoopInBreak , LeadingPlusNotSupported , LeftArrowOperator ,
2121 LifetimeInBorrowExpression , MacroInvocationWithQualifiedPath , MalformedLoopLabel ,
2222 MatchArmBodyWithoutBraces , MatchArmBodyWithoutBracesSugg , MissingCommaAfterMatchArm ,
23- MissingInInForLoop , MissingInInForLoopSub , MissingSemicolonBeforeArray , NoFieldsForFnCall ,
24- NotAsNegationOperator , NotAsNegationOperatorSub , OctalFloatLiteralNotSupported ,
25- OuterAttributeNotAllowedOnIfElse , ParenthesesWithStructFields ,
23+ MissingDotDot , MissingInInForLoop , MissingInInForLoopSub , MissingSemicolonBeforeArray ,
24+ NoFieldsForFnCall , NotAsNegationOperator , NotAsNegationOperatorSub ,
25+ OctalFloatLiteralNotSupported , OuterAttributeNotAllowedOnIfElse , ParenthesesWithStructFields ,
2626 RequireColonAfterLabeledExpression , ShiftInterpretedAsGeneric , StructLiteralNotAllowedHere ,
2727 StructLiteralNotAllowedHereSugg , TildeAsUnaryOperator , UnexpectedTokenAfterLabel ,
2828 UnexpectedTokenAfterLabelSugg , WrapExpressionInParentheses ,
@@ -2897,6 +2897,21 @@ impl<'a> Parser<'a> {
28972897 }
28982898 self . recover_struct_comma_after_dotdot ( exp_span) ;
28992899 break ;
2900+ } else if self . token == token:: DotDotDot {
2901+ // suggest `..v` instead of `...v`
2902+ let snapshot = self . create_snapshot_for_diagnostic ( ) ;
2903+ let span = self . token . span ;
2904+ self . bump ( ) ;
2905+ match self . parse_expr ( ) {
2906+ Ok ( _p) => {
2907+ self . sess . emit_err ( MissingDotDot { token_span : span, sugg_span : span } ) ;
2908+ break ;
2909+ }
2910+ Err ( inner_err) => {
2911+ inner_err. cancel ( ) ;
2912+ self . restore_snapshot ( snapshot) ;
2913+ }
2914+ }
29002915 }
29012916
29022917 let recovery_field = self . find_struct_error_after_field_looking_code ( ) ;
0 commit comments