From 1658ca082a1d510480a7c228b0b6bfb83863d0e9 Mon Sep 17 00:00:00 2001 From: Lieselotte <52315535+she3py@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:47:10 +0100 Subject: Properly emit `expected ;` on `#[attr] expr` --- compiler/rustc_parse/src/parser/diagnostics.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index cc1f7c8ac7d..995e140b329 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -800,9 +800,8 @@ impl<'a> Parser<'a> { { Ok(next_attr) => next_attr, Err(inner_err) => { - err.cancel(); inner_err.cancel(); - return self.dcx().span_delayed_bug(expr.span, "not a tail expression"); + return err.emit(); } } && let ast::AttrKind::Normal(next_attr_kind) = next_attr.kind @@ -813,9 +812,8 @@ impl<'a> Parser<'a> { let next_expr = match snapshot.parse_expr() { Ok(next_expr) => next_expr, Err(inner_err) => { - err.cancel(); inner_err.cancel(); - return self.dcx().span_delayed_bug(expr.span, "not a tail expression"); + return err.emit(); } }; // We have for sure -- cgit 1.4.1-3-g733a5