about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-30 18:00:53 +0900
committerGitHub <noreply@github.com>2020-10-30 18:00:53 +0900
commit8111706c18aebe273457b0967e076bf5e105a382 (patch)
treea16a4a5fdcd1e3ea8d33074b266bd137fb2f03e3 /compiler/rustc_parse/src/parser
parent02a4b58a3fe3d245417b47b8a9ebb146fbe5b413 (diff)
parent9ae713057aa79c7f582bd9f7e6aac0032b6e2ea4 (diff)
downloadrust-8111706c18aebe273457b0967e076bf5e105a382.tar.gz
rust-8111706c18aebe273457b0967e076bf5e105a382.zip
Rollup merge of #78523 - estebank:fix-return-type-parse-regression, r=dtolnay
Revert invalid `fn` return type parsing change

Revert one of the changes in #78379.

Fix #78507.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 39d4875f37b..26492d92a77 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1666,19 +1666,10 @@ impl<'a> Parser<'a> {
         req_name: ReqName,
         ret_allow_plus: AllowPlus,
     ) -> PResult<'a, P<FnDecl>> {
-        let inputs = self.parse_fn_params(req_name)?;
-        let output = self.parse_ret_ty(ret_allow_plus, RecoverQPath::Yes)?;
-
-        if let ast::FnRetTy::Ty(ty) = &output {
-            if let TyKind::Path(_, Path { segments, .. }) = &ty.kind {
-                if let [.., last] = &segments[..] {
-                    // Detect and recover `fn foo() -> Vec<i32>> {}`
-                    self.check_trailing_angle_brackets(last, &[&token::OpenDelim(token::Brace)]);
-                }
-            }
-        }
-
-        Ok(P(FnDecl { inputs, output }))
+        Ok(P(FnDecl {
+            inputs: self.parse_fn_params(req_name)?,
+            output: self.parse_ret_ty(ret_allow_plus, RecoverQPath::Yes)?,
+        }))
     }
 
     /// Parses the parameter list of a function, including the `(` and `)` delimiters.