Change:
The CI for started to fail today with this error: It appears as though the compiler doesn't see and only sees as the range expression and then generates this error. The expression is inside a expansion. You can reproduce this by cloning the repo and building it: The build succeeds on the stable channel and much older releases, so this appears to be a regression in the nightly. Here's the version on my windows system, but note that this also fails on linux and macos too:
Regression introduced in
More specifically the bug is in: which is called to see whether what follows is a valid start of a range pattern end expression. This is strange tho... in the case of e.g.: the call to in is used successfully to parse but somehow that doesn't work for . cc
Similarly, with: this does not trigger "error: range patterns are not supported" but it should.

Discussion:
$p.token.span, ExprKind::Block(block, None), ThinVec::new() )); } <ins> // N.B: `NtIdent(ident)` is normalized to `Ident` in `fn bump`. </ins> _ => {}, }; }

// can't continue an expression after an ident token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw), token::Literal(..) | token::Pound => true, <del> token::Interpolated(ref nt) => match **nt { token::NtIdent(..) | token::NtExpr(..) | token::NtBlock(..) | token::NtPath(..) => true, _ => false, }, _ => false </del> <ins> _ => t.is_whole_expr(), </ins> }; let cannot_continue_expr = self.look_ahead(1, token_cannot_continue_expr); if cannot_continue_expr {

self.token.is_path_start() // e.g. `MY_CONST`; || self.token == token::Dot // e.g. `.5` for recovery; || self.token.can_begin_literal_or_bool() // e.g. `42`. <ins> || self.token.is_whole_expr() </ins> } // Helper function to decide whether to parse as ident binding

false } <ins> /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`? /// That is, is this a pre-parsed expression dropped into the token stream /// (which happens while parsing the result of macro expansion)? crate fn is_whole_expr(&self) -> bool { if let Interpolated(ref nt) = self.kind { if let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtIdent(..) | NtBlock(_) = **nt { return true; } } false } </ins> /// Returns `true` if the token is either the `mut` or `const` keyword. crate fn is_mutability(&self) -> bool { self.is_keyword(kw::Mut) ||

<ins> // check-pass #![feature(exclusive_range_pattern)] #![allow(ellipsis_inclusive_range_patterns)] fn main() { macro_rules! mac_expr { ($e:expr) => { if let 2...$e = 3 {} if let 2..=$e = 3 {} if let 2..$e = 3 {} } } mac_expr!(4); } </ins>

//~| ERROR `...` range patterns are deprecated //~| ERROR mismatched types } <ins> fn with_macro_expr_var() { macro_rules! mac2 { ($e1:expr, $e2:expr) => { let $e1..$e2; let $e1...$e2; //~^ ERROR `...` range patterns are deprecated let $e1..=$e2; } } mac2!(0, 1); macro_rules! mac { ($e:expr) => { let ..$e; //~ ERROR `..X` range patterns are not supported let ...$e; //~ ERROR `...X` range patterns are not supported //~^ ERROR `...` range patterns are deprecated let ..=$e; //~ ERROR `..=X` range patterns are not supported let $e..; //~ ERROR `X..` range patterns are not supported let $e...; //~ ERROR `X...` range patterns are not supported //~^ ERROR `...` range patterns are deprecated let $e..=; //~ ERROR `X..=` range patterns are not supported } } mac!(0); } </ins>

LL |     if let ....3 = 0 {} |            ^^^^^ help: try using the minimum value for the type: `MIN...0.3` <ins> error: `..X` range patterns are not supported --> $DIR/recover-range-pats.rs:139:17 | LL |             let ..$e; |                 ^^ help: try using the minimum value for the type: `MIN..0` ... LL |     mac!(0); |     -------- in this macro invocation error: `...X` range patterns are not supported --> $DIR/recover-range-pats.rs:140:17 | LL |             let ...$e; |                 ^^^ help: try using the minimum value for the type: `MIN...0` ... LL |     mac!(0); |     -------- in this macro invocation error: `..=X` range patterns are not supported --> $DIR/recover-range-pats.rs:142:17 | LL |             let ..=$e; |                 ^^^ help: try using the minimum value for the type: `MIN..=0` ... LL |     mac!(0); |     -------- in this macro invocation error: `X..` range patterns are not supported --> $DIR/recover-range-pats.rs:143:19 | LL |             let $e..; |                   ^^ help: try using the maximum value for the type: `0..MAX` ... LL |     mac!(0); |     -------- in this macro invocation error: `X...` range patterns are not supported --> $DIR/recover-range-pats.rs:144:19 | LL |             let $e...; |                   ^^^ help: try using the maximum value for the type: `0...MAX` ... LL |     mac!(0); |     -------- in this macro invocation error: `X..=` range patterns are not supported --> $DIR/recover-range-pats.rs:146:19 | LL |             let $e..=; |                   ^^^ help: try using the maximum value for the type: `0..=MAX` ... LL |     mac!(0); |     -------- in this macro invocation </ins> error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:41:13 |

LL |     if let ....3 = 0 {} |            ^^^ help: use `..=` for an inclusive range <ins> error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:129:20 | LL |             let $e1...$e2; |                    ^^^ help: use `..=` for an inclusive range ... LL |     mac2!(0, 1); |     ------------ in this macro invocation error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:140:17 | LL |             let ...$e; |                 ^^^ help: use `..=` for an inclusive range ... LL |     mac!(0); |     -------- in this macro invocation error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:144:19 | LL |             let $e...; |                   ^^^ help: use `..=` for an inclusive range ... LL |     mac!(0); |     -------- in this macro invocation </ins> error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/recover-range-pats.rs:19:12 |

= note: expected type `{integer}` found type `{float}` <del> error: aborting due to 76 previous errors </del> <ins> error: aborting due to 85 previous errors </ins> Some errors have detailed explanations: E0029, E0308. For more information about an error, try `rustc --explain E0029`.