Skip to content

Commit 814ea59

Browse files
committed
Remove a use of maybe_whole_expr.
In this context there's no need to look for `NtPath` or `NtBlock`.
1 parent a322848 commit 814ea59

File tree

1 file changed

+7
-1
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+7
-1
lines changed

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,13 @@ impl<'a> Parser<'a> {
19661966
/// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`).
19671967
/// Keep this in sync with `Token::can_begin_literal_maybe_minus`.
19681968
pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>> {
1969-
maybe_whole_expr!(self);
1969+
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+
}
19701976

19711977
let lo = self.token.span;
19721978
let minus_present = self.eat(&token::BinOp(token::Minus));

0 commit comments

Comments
 (0)