Parse async fn header.
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
This commit is contained in:
parent
4b17d31f11
commit
18ff7d091a
33 changed files with 367 additions and 288 deletions
|
@ -928,12 +928,15 @@ mod tests {
|
|||
output: ast::FunctionRetTy::Default(sp(15, 15)),
|
||||
variadic: false
|
||||
}),
|
||||
ast::Unsafety::Normal,
|
||||
Spanned {
|
||||
span: sp(0,2),
|
||||
node: ast::Constness::NotConst,
|
||||
ast::FnHeader {
|
||||
unsafety: ast::Unsafety::Normal,
|
||||
asyncness: ast::IsAsync::NotAsync,
|
||||
constness: Spanned {
|
||||
span: sp(0,2),
|
||||
node: ast::Constness::NotConst,
|
||||
},
|
||||
abi: Abi::Rust,
|
||||
},
|
||||
Abi::Rust,
|
||||
ast::Generics{
|
||||
params: Vec::new(),
|
||||
where_clause: ast::WhereClause {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue