@@ -2783,10 +2783,11 @@ impl<'a> Parser<'a> {
27832783 if op. precedence ( ) < min_prec {
27842784 break ;
27852785 }
2786- // Warn about deprecated ... syntax (until SNAP)
2787- if self . token == token:: DotDotDot {
2788- self . warn_dotdoteq ( self . span ) ;
2786+ // Check for deprecated ` ...` syntax
2787+ if self . token == token:: DotDotDot && op == AssocOp :: DotDotEq {
2788+ self . err_dotdotdot_syntax ( self . span ) ;
27892789 }
2790+
27902791 self . bump ( ) ;
27912792 if op. is_comparison ( ) {
27922793 self . check_no_chained_comparison ( & lhs, & op) ;
@@ -2819,7 +2820,6 @@ impl<'a> Parser<'a> {
28192820 //
28202821 // We have 2 alternatives here: `x..y`/`x..=y` and `x..`/`x..=` The other
28212822 // two variants are handled with `parse_prefix_range_expr` call above.
2822- // (and `x...y`/`x...` until SNAP)
28232823 let rhs = if self . is_at_start_of_range_notation_rhs ( ) {
28242824 Some ( self . parse_assoc_expr_with ( op. precedence ( ) + 1 ,
28252825 LhsExpr :: NotYetParsed ) ?)
@@ -3007,22 +3007,22 @@ impl<'a> Parser<'a> {
30073007 }
30083008 }
30093009
3010- /// Parse prefix-forms of range notation: `..expr`, `..`, `..=expr` (and `...expr` until SNAP)
3010+ /// Parse prefix-forms of range notation: `..expr`, `..`, `..=expr`
30113011 fn parse_prefix_range_expr ( & mut self ,
30123012 already_parsed_attrs : Option < ThinVec < Attribute > > )
30133013 -> PResult < ' a , P < Expr > > {
3014- // SNAP remove DotDotDot
3014+ // Check for deprecated `...` syntax
3015+ if self . token == token:: DotDotDot {
3016+ self . err_dotdotdot_syntax ( self . span ) ;
3017+ }
3018+
30153019 debug_assert ! ( [ token:: DotDot , token:: DotDotDot , token:: DotDotEq ] . contains( & self . token) ,
3016- "parse_prefix_range_expr: token {:?} is not DotDot/DotDotDot/ DotDotEq" ,
3020+ "parse_prefix_range_expr: token {:?} is not DotDot/DotDotEq" ,
30173021 self . token) ;
30183022 let tok = self . token . clone ( ) ;
30193023 let attrs = self . parse_or_use_outer_attributes ( already_parsed_attrs) ?;
30203024 let lo = self . span ;
30213025 let mut hi = self . span ;
3022- // Warn about deprecated ... syntax (until SNAP)
3023- if tok == token:: DotDotDot {
3024- self . warn_dotdoteq ( self . span ) ;
3025- }
30263026 self . bump ( ) ;
30273027 let opt_end = if self . is_at_start_of_range_notation_rhs ( ) {
30283028 // RHS must be parsed with more associativity than the dots.
@@ -4332,9 +4332,13 @@ impl<'a> Parser<'a> {
43324332 } ) . emit ( ) ;
43334333 }
43344334
4335- fn warn_dotdoteq ( & self , span : Span ) {
4336- self . diagnostic ( ) . struct_span_warn ( span, {
4337- "`...` is being replaced by `..=`"
4335+ fn err_dotdotdot_syntax ( & self , span : Span ) {
4336+ self . diagnostic ( ) . struct_span_err ( span, {
4337+ "`...` syntax cannot be used in expressions"
4338+ } ) . help ( {
4339+ "Use `..` if you need an exclusive range (a < b)"
4340+ } ) . help ( {
4341+ "or `..=` if you need an inclusive range (a <= b)"
43384342 } ) . emit ( ) ;
43394343 }
43404344
0 commit comments