summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-10-29 08:26:42 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-10-29 08:26:42 -0700
commitf9a26643ecd72cf75d0d5b87c40979816fdaef22 (patch)
tree2ebe5b5634df25573b5748bd03078dacd0566814 /compiler/rustc_parse/src/parser
parent31ee872db5aae4750e3da1ca4ed1523c4356947f (diff)
downloadrust-f9a26643ecd72cf75d0d5b87c40979816fdaef22.tar.gz
rust-f9a26643ecd72cf75d0d5b87c40979816fdaef22.zip
Revert invalid `fn` return type parsing change
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.