syntax: unify and simplify fn signature parsing.
This commit is contained in:
parent
7f9638d5d4
commit
a7ba754b6c
5 changed files with 88 additions and 92 deletions
|
@ -4,7 +4,7 @@ use crate::{maybe_whole, maybe_recover_from_interpolated_ty_qpath};
|
|||
use crate::ptr::P;
|
||||
use crate::ast::{self, Ty, TyKind, MutTy, BareFnTy, FunctionRetTy, GenericParam, Lifetime, Ident};
|
||||
use crate::ast::{TraitBoundModifier, TraitObjectSyntax, GenericBound, GenericBounds, PolyTraitRef};
|
||||
use crate::ast::{Mutability, AnonConst, FnDecl, Mac};
|
||||
use crate::ast::{Mutability, AnonConst, Mac};
|
||||
use crate::parse::token::{self, Token};
|
||||
use crate::source_map::Span;
|
||||
use crate::symbol::{kw};
|
||||
|
@ -288,12 +288,12 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
self.expect_keyword(kw::Fn)?;
|
||||
let inputs = self.parse_fn_params(false, true)?;
|
||||
let ret_ty = self.parse_ret_ty(false)?;
|
||||
let decl = P(FnDecl {
|
||||
inputs,
|
||||
output: ret_ty,
|
||||
});
|
||||
let cfg = super::ParamCfg {
|
||||
is_self_allowed: false,
|
||||
allow_c_variadic: true,
|
||||
is_name_required: |_| false,
|
||||
};
|
||||
let decl = self.parse_fn_decl(cfg, false)?;
|
||||
Ok(TyKind::BareFn(P(BareFnTy {
|
||||
abi,
|
||||
unsafety,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue