diff options
| author | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-10 02:06:11 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-11 13:42:40 +0100 |
| commit | c2b906ba9a29591536042be4bbf8d0156225bb73 (patch) | |
| tree | f51776c8b17df5c9cfc90aea7796ab3f088bc5fe /compiler/rustc_parse/src/errors.rs | |
| parent | b7b7f2716ee1655a696d3d64c3e12638d0dd19c0 (diff) | |
| download | rust-c2b906ba9a29591536042be4bbf8d0156225bb73.tar.gz rust-c2b906ba9a29591536042be4bbf8d0156225bb73.zip | |
Recover from fn ptr tys with generic param list
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index e3acc11811f..69fe805e9cd 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1278,3 +1278,24 @@ pub(crate) struct DoubleColonInBound { #[suggestion(code = ": ", applicability = "machine-applicable")] pub between: Span, } + +#[derive(Diagnostic)] +#[diag(parser_fn_ptr_with_generics)] +pub(crate) struct FnPtrWithGenerics { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub sugg: Option<FnPtrWithGenericsSugg>, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(suggestion, applicability = "maybe-incorrect")] +pub(crate) struct FnPtrWithGenericsSugg { + #[suggestion_part(code = "{snippet}")] + pub left: Span, + pub snippet: String, + #[suggestion_part(code = "")] + pub right: Span, + pub arity: usize, + pub for_param_list_exists: bool, +} |
