-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Provide #[diagnostic::on_incomplete_macro_args] to customize macro call errors #152494
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
In #152493 there's an example of a built-in macro where not passing enough arguments to the macro call produces
Both built-in and third-party macros could do with a mechanism to customize the error being emitted when a specific macro arm doesn't match and when no macro arm matches. This would allow for crate authors to emit additional information guiding users towards the correct intended usage.
This could be as simple as
Although ideally we should be able to annotate individual match arms (which might be a change in the grammar?).