about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorYuki Okushi <yuki.okushi@huawei.com>2021-07-31 06:09:54 +0900
committerYuki Okushi <yuki.okushi@huawei.com>2021-07-31 06:09:54 +0900
commitd2d851949bab4c96b54d11126a0efd1826557d3f (patch)
tree3e8393a6f4eba91ef540c48e6ec7a0c1a687e149 /compiler/rustc_parse/src/parser
parentf3f8e758f2b2abd84b76bcb4ec0b6ae263e1e7b9 (diff)
downloadrust-d2d851949bab4c96b54d11126a0efd1826557d3f.tar.gz
rust-d2d851949bab4c96b54d11126a0efd1826557d3f.zip
Fix a parser ICE on invalid `fn` body
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 2ce63d011f4..1e4bc49cb39 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1715,13 +1715,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)