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.
This commit is contained in:
commit
8111706c18
4 changed files with 14 additions and 17 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue