diff options
| author | Eric Holk <ericholk@microsoft.com> | 2023-11-28 10:15:39 -0800 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2023-12-04 11:22:49 -0800 |
| commit | bc0d10d4b0fefccda6aae0338a1935d76314736b (patch) | |
| tree | ad2b4910b507a3f1720d29da7006afda28647995 /compiler/rustc_parse/src/parser | |
| parent | e281163dc83dd747a817bdfbb81bf59c3747f7dc (diff) | |
| download | rust-bc0d10d4b0fefccda6aae0338a1935d76314736b.tar.gz rust-bc0d10d4b0fefccda6aae0338a1935d76314736b.zip | |
Add genness to FnHeader
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index a737f37a104..55f7310681f 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2543,6 +2543,7 @@ impl<'a> Parser<'a> { constness: recover_constness, unsafety: recover_unsafety, asyncness: recover_asyncness, + genness, // FIXME(eholk): add keyword recovery logic here too. ext, }); } @@ -2552,7 +2553,7 @@ impl<'a> Parser<'a> { } } - Ok(FnHeader { constness, unsafety, asyncness, ext }) + Ok(FnHeader { constness, unsafety, asyncness, ext, genness }) } /// Parses the parameter list and result type of a function declaration. diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index b1a57c3dfd9..cf0dd39b562 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -596,7 +596,7 @@ impl<'a> Parser<'a> { tokens: None, }; let span_start = self.token.span; - let ast::FnHeader { ext, unsafety, constness, asyncness } = + let ast::FnHeader { ext, unsafety, constness, asyncness, genness: _ } = self.parse_fn_front_matter(&inherited_vis, Case::Sensitive)?; if self.may_recover() && self.token.kind == TokenKind::Lt { self.recover_fn_ptr_with_generics(lo, &mut params, param_insertion_point)?; @@ -612,6 +612,7 @@ impl<'a> Parser<'a> { if let ast::Async::Yes { span, .. } = asyncness { self.sess.emit_err(FnPointerCannotBeAsync { span: whole_span, qualifier: span }); } + // FIXME(eholk): emit a similar error for `gen fn()` let decl_span = span_start.to(self.token.span); Ok(TyKind::BareFn(P(BareFnTy { ext, unsafety, generic_params: params, decl, decl_span }))) } |
