about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorEzra Shaw <ezrasure@outlook.com>2023-01-16 16:18:56 +1300
committerEzra Shaw <ezrasure@outlook.com>2023-01-16 16:18:56 +1300
commitfcd5ed21b77dd1d72696e43dd70e60b1ad458f55 (patch)
tree93f3abc201640c97b834fe3cf241600026464234 /compiler/rustc_parse/src/parser
parente590b934998c85175b85cb13842163a27a221dc7 (diff)
downloadrust-fcd5ed21b77dd1d72696e43dd70e60b1ad458f55.tar.gz
rust-fcd5ed21b77dd1d72696e43dd70e60b1ad458f55.zip
fix dropping diagnostic without emit
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/ty.rs3
1 files changed, 2 insertions, 1 deletions
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");