@@ -2784,10 +2784,11 @@ impl<'a> Parser<'a> {
27842784 if op. precedence ( ) < min_prec {
27852785 break ;
27862786 }
2787- // Warn about deprecated ... syntax (until SNAP)
2788- if self . token == token:: DotDotDot {
2789- self . warn_dotdoteq ( self . span ) ;
2787+ // Check for deprecated ` ...` syntax
2788+ if self . token == token:: DotDotDot && op == AssocOp :: DotDotEq {
2789+ self . err_dotdotdot_syntax ( self . span ) ;
27902790 }
2791+
27912792 self . bump ( ) ;
27922793 if op. is_comparison ( ) {
27932794 self . check_no_chained_comparison ( & lhs, & op) ;
@@ -2820,7 +2821,6 @@ impl<'a> Parser<'a> {
28202821 //
28212822 // We have 2 alternatives here: `x..y`/`x..=y` and `x..`/`x..=` The other
28222823 // two variants are handled with `parse_prefix_range_expr` call above.
2823- // (and `x...y`/`x...` until SNAP)
28242824 let rhs = if self . is_at_start_of_range_notation_rhs ( ) {
28252825 Some ( self . parse_assoc_expr_with ( op. precedence ( ) + 1 ,
28262826 LhsExpr :: NotYetParsed ) ?)
@@ -3008,22 +3008,22 @@ impl<'a> Parser<'a> {
30083008 }
30093009 }
30103010
3011- /// Parse prefix-forms of range notation: `..expr`, `..`, `..=expr` (and `...expr` until SNAP)
3011+ /// Parse prefix-forms of range notation: `..expr`, `..`, `..=expr`
30123012 fn parse_prefix_range_expr ( & mut self ,
30133013 already_parsed_attrs : Option < ThinVec < Attribute > > )
30143014 -> PResult < ' a , P < Expr > > {
3015- // SNAP remove DotDotDot
3015+ // Check for deprecated `...` syntax
3016+ if self . token == token:: DotDotDot {
3017+ self . err_dotdotdot_syntax ( self . span ) ;
3018+ }
3019+
30163020 debug_assert ! ( [ token:: DotDot , token:: DotDotDot , token:: DotDotEq ] . contains( & self . token) ,
3017- "parse_prefix_range_expr: token {:?} is not DotDot/DotDotDot/ DotDotEq" ,
3021+ "parse_prefix_range_expr: token {:?} is not DotDot/DotDotEq" ,
30183022 self . token) ;
30193023 let tok = self . token . clone ( ) ;
30203024 let attrs = self . parse_or_use_outer_attributes ( already_parsed_attrs) ?;
30213025 let lo = self . span ;
30223026 let mut hi = self . span ;
3023- // Warn about deprecated ... syntax (until SNAP)
3024- if tok == token:: DotDotDot {
3025- self . warn_dotdoteq ( self . span ) ;
3026- }
30273027 self . bump ( ) ;
30283028 let opt_end = if self . is_at_start_of_range_notation_rhs ( ) {
30293029 // RHS must be parsed with more associativity than the dots.
@@ -4271,9 +4271,13 @@ impl<'a> Parser<'a> {
42714271 } ) . emit ( ) ;
42724272 }
42734273
4274- fn warn_dotdoteq ( & self , span : Span ) {
4275- self . diagnostic ( ) . struct_span_warn ( span, {
4276- "`...` is being replaced by `..=`"
4274+ fn err_dotdotdot_syntax ( & self , span : Span ) {
4275+ self . diagnostic ( ) . struct_span_err ( span, {
4276+ "`...` syntax cannot be used in expressions"
4277+ } ) . help ( {
4278+ "Use `..` if you need an exclusive range (a < b)"
4279+ } ) . help ( {
4280+ "or `..=` if you need an inclusive range (a <= b)"
42774281 } ) . emit ( ) ;
42784282 }
42794283
0 commit comments