From fcd5ed21b77dd1d72696e43dd70e60b1ad458f55 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Mon, 16 Jan 2023 16:18:56 +1300 Subject: [PATCH] fix dropping diagnostic without emit --- compiler/rustc_parse/src/parser/ty.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index aedebd0fb70..1766b0293de 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -941,7 +941,8 @@ impl<'a> Parser<'a> { && let Some(path) = self.recover_path_from_fn() { path - } else if !self.token.is_path_start() && self.token.can_begin_type() && let Ok(ty) = self.parse_ty_no_plus() { + } else if !self.token.is_path_start() && self.token.can_begin_type() { + let ty = self.parse_ty_no_plus()?; // Instead of finding a path (a trait), we found a type. let mut err = self.struct_span_err(ty.span, "expected a trait, found type");