diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-18 08:16:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-18 08:16:25 +0100 |
| commit | 54e7946d0fde56ea25b331df8d971bed0d232cac (patch) | |
| tree | edc8902c45141c72da3566abacd80c96f84eebbf /compiler/rustc_parse/src/parser/ty.rs | |
| parent | dde825db464b08d6f572766579dfb629b837368c (diff) | |
| parent | be33ca7d5b9c79a649ff4c38e0d351df326ff93c (diff) | |
| download | rust-54e7946d0fde56ea25b331df8d971bed0d232cac.tar.gz rust-54e7946d0fde56ea25b331df8d971bed0d232cac.zip | |
Rollup merge of #87901 - poliorcetics:pub-pub-pub, r=jackh726
Fix suggestion of additional `pub` when using `pub pub fn ...` Fix #87694. Marked as draft to start with because I want to explore doing the same fix for `const const fn` and other repeated-but-valid keywords. `@rustbot` label A-diagnostics D-invalid-suggestion T-compiler
Diffstat (limited to 'compiler/rustc_parse/src/parser/ty.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 9bfde0e3900..02a774ba129 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -474,7 +474,13 @@ impl<'a> Parser<'a> { params: Vec<GenericParam>, recover_return_sign: RecoverReturnSign, ) -> PResult<'a, TyKind> { - let ast::FnHeader { ext, unsafety, constness, asyncness } = self.parse_fn_front_matter()?; + let inherited_vis = rustc_ast::Visibility { + span: rustc_span::DUMMY_SP, + kind: rustc_ast::VisibilityKind::Inherited, + tokens: None, + }; + 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)?; let whole_span = lo.to(self.prev_token.span); if let ast::Const::Yes(span) = constness { |
