1
Fork 0

Recover from fn ptr tys with generic param list

This commit is contained in:
León Orell Valerian Liehr 2022-11-10 02:06:11 +01:00
parent b7b7f2716e
commit c2b906ba9a
No known key found for this signature in database
GPG key ID: CD75E31CE2CFD7D9
6 changed files with 228 additions and 3 deletions

View file

@ -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,
}