@@ -20,9 +20,9 @@ use crate::errors::{
20
20
InvalidNumLiteralSuffix , LabeledLoopInBreak , LeadingPlusNotSupported , LeftArrowOperator ,
21
21
LifetimeInBorrowExpression , MacroInvocationWithQualifiedPath , MalformedLoopLabel ,
22
22
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 ,
26
26
RequireColonAfterLabeledExpression , ShiftInterpretedAsGeneric , StructLiteralNotAllowedHere ,
27
27
StructLiteralNotAllowedHereSugg , TildeAsUnaryOperator , UnexpectedTokenAfterLabel ,
28
28
UnexpectedTokenAfterLabelSugg , WrapExpressionInParentheses ,
@@ -2897,6 +2897,21 @@ impl<'a> Parser<'a> {
2897
2897
}
2898
2898
self . recover_struct_comma_after_dotdot ( exp_span) ;
2899
2899
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
+ }
2900
2915
}
2901
2916
2902
2917
let recovery_field = self . find_struct_error_after_field_looking_code ( ) ;
0 commit comments