We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
maybe_whole_expr
1 parent a322848 commit 814ea59Copy full SHA for 814ea59
compiler/rustc_parse/src/parser/expr.rs
@@ -1966,7 +1966,13 @@ impl<'a> Parser<'a> {
1966
/// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`).
1967
/// Keep this in sync with `Token::can_begin_literal_maybe_minus`.
1968
pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>> {
1969
- maybe_whole_expr!(self);
+ if let token::Interpolated(nt) = &self.token.kind
1970
+ && let token::NtExpr(e) | token::NtLiteral(e) = &**nt
1971
+ {
1972
+ let e = e.clone();
1973
+ self.bump();
1974
+ return Ok(e);
1975
+ }
1976
1977
let lo = self.token.span;
1978
let minus_present = self.eat(&token::BinOp(token::Minus));
0 commit comments