about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-05-10 21:17:21 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-05-20 12:26:37 +0200
commitdb8a9274a9e3feb90c3db5f7046f9b3566867f5a (patch)
treed99321ac6366f3f399a02e50f51988148f8c04e9 /compiler/rustc_parse/src/parser
parent5953c57f27cdb41d86530e7038d7f191e3f1c74e (diff)
downloadrust-db8a9274a9e3feb90c3db5f7046f9b3566867f5a.tar.gz
rust-db8a9274a9e3feb90c3db5f7046f9b3566867f5a.zip
Introduce BareFnTy::decl_span and fix generics span.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/ty.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs
index b0439a5987a..fb3f5eb3f9f 100644
--- a/compiler/rustc_parse/src/parser/ty.rs
+++ b/compiler/rustc_parse/src/parser/ty.rs
@@ -518,6 +518,7 @@ impl<'a> Parser<'a> {
             kind: rustc_ast::VisibilityKind::Inherited,
             tokens: None,
         };
+        let span_start = self.token.span;
         let ast::FnHeader { ext, unsafety, constness, asyncness } =
             self.parse_fn_front_matter(&inherited_vis)?;
         let decl = self.parse_fn_decl(|_| false, AllowPlus::No, recover_return_sign)?;
@@ -531,7 +532,8 @@ impl<'a> Parser<'a> {
         if let ast::Async::Yes { span, .. } = asyncness {
             self.error_fn_ptr_bad_qualifier(whole_span, span, "async");
         }
-        Ok(TyKind::BareFn(P(BareFnTy { ext, unsafety, generic_params: params, decl })))
+        let decl_span = span_start.to(self.token.span);
+        Ok(TyKind::BareFn(P(BareFnTy { ext, unsafety, generic_params: params, decl, decl_span })))
     }
 
     /// Emit an error for the given bad function pointer qualifier.