diff options
| author | Without Boats <boats@mozilla.com> | 2018-05-16 22:55:18 -0700 |
|---|---|---|
| committer | Taylor Cramer <cramertj@google.com> | 2018-06-21 22:29:47 -0700 |
| commit | 18ff7d091a07706b87c131bf3efc226993916f88 (patch) | |
| tree | 733af2f6f405efc1f1c3f79471a61c9c1d128cd4 /src/libsyntax_ext/deriving/generic | |
| parent | 4b17d31f1147f840231c43b1ac1478a497af20df (diff) | |
| download | rust-18ff7d091a07706b87c131bf3efc226993916f88.tar.gz rust-18ff7d091a07706b87c131bf3efc226993916f88.zip | |
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.
Diffstat (limited to 'src/libsyntax_ext/deriving/generic')
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 672726d1475..3ea0eb8bbd8 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -197,7 +197,7 @@ use syntax::ast::{VariantData, GenericParamKind, GenericArg}; use syntax::attr; use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::ext::build::AstBuilder; -use syntax::codemap::{self, dummy_spanned, respan}; +use syntax::codemap::{self, respan}; use syntax::util::move_map::MoveMap; use syntax::ptr::P; use syntax::symbol::{Symbol, keywords}; @@ -971,10 +971,10 @@ impl<'a> MethodDef<'a> { defaultness: ast::Defaultness::Final, ident: method_ident, node: ast::ImplItemKind::Method(ast::MethodSig { - abi, - unsafety, - constness: - dummy_spanned(ast::Constness::NotConst), + header: ast::FnHeader { + unsafety, abi, + ..ast::FnHeader::default() + }, decl: fn_decl, }, body_block), |
