Rollup merge of #140671 - xizheyin:issue-140169, r=petrochenkov

Parser: Recover error from named params while parse_path

Fixes #140169

I added test to the first commit and the second added the code and changes to test.

r? `@petrochenkov`
This commit is contained in:
Guillaume Gomez
2025-05-07 18:19:06 +02:00
committed by GitHub
10 changed files with 167 additions and 58 deletions

View File

@@ -1646,6 +1646,30 @@ pub(crate) struct ExpectedFnPathFoundFnKeyword {
pub fn_token_span: Span,
}
#[derive(Diagnostic)]
#[diag(parse_path_found_named_params)]
pub(crate) struct FnPathFoundNamedParams {
#[primary_span]
#[suggestion(applicability = "machine-applicable", code = "")]
pub named_param_span: Span,
}
#[derive(Diagnostic)]
#[diag(parse_path_found_c_variadic_params)]
pub(crate) struct PathFoundCVariadicParams {
#[primary_span]
#[suggestion(applicability = "machine-applicable", code = "")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(parse_path_found_attribute_in_params)]
pub(crate) struct PathFoundAttributeInParams {
#[primary_span]
#[suggestion(applicability = "machine-applicable", code = "")]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(parse_path_double_colon)]
pub(crate) struct PathSingleColon {