about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-08-03 19:07:44 +0900
committerGitHub <noreply@github.com>2021-08-03 19:07:44 +0900
commitf69daa261742f447f269d1ee9f814dfd5cb4eb1b (patch)
tree50c0a0d230dbf2519d669e808e6f3aec02d1d90d /compiler/rustc_parse/src/parser
parent345862d2245c2fe132c793ab528709045b38beaa (diff)
parentd2d851949bab4c96b54d11126a0efd1826557d3f (diff)
downloadrust-f69daa261742f447f269d1ee9f814dfd5cb4eb1b.tar.gz
rust-f69daa261742f447f269d1ee9f814dfd5cb4eb1b.zip
Rollup merge of #87646 - JohnTitor:fix-parser-ice, r=oli-obk
Fix a parser ICE on invalid `fn` body

Fixes #87635
A better fix would add a check for `fn` body on `expected_one_of_not_found` but I haven't come up with a graceful way. Any idea?
r? ```@oli-obk``` ```@estebank```
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index f77f9bc454b..9fcf2c4d5ec 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1714,13 +1714,11 @@ impl<'a> Parser<'a> {
                     // the AST for typechecking.
                     err.span_label(ident.span, "while parsing this `fn`");
                     err.emit();
-                    (Vec::new(), None)
                 } else {
                     return Err(err);
                 }
-            } else {
-                unreachable!()
             }
+            (Vec::new(), None)
         };
         attrs.extend(inner_attrs);
         Ok(body)