-
Notifications
You must be signed in to change notification settings - Fork 2k
Address FIXMEs for adding diagnostics #22140
Copy link
Copy link
Open
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingC-featureCategory: feature requestCategory: feature requestC-tracking-issueCategory: tracking issueCategory: tracking issueE-easyE-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get started
Metadata
Metadata
Assignees
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingC-featureCategory: feature requestCategory: feature requestC-tracking-issueCategory: tracking issueCategory: tracking issueE-easyE-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get started
Type
Fields
Give feedbackNo fields configured for issues without a type.
We have quite a lot of FIXMEs, mostly in hir-ty, for adding new diagnostics for things (and I'm constantly adding more). The shape of them is like
FIXME: Emit an error ...(my own FIXMEs usually use these words, others might use similar). Most are pretty easy to do. The steps to resolve one (in inference) are:InferenceDiagnosticwith the necessary information.self.push_diagnostic(diag)on the place.hir/src/diagnostics.rs, add a new struct for the diagnostic and convert the enum variant to it in the functions of that module. Note: this struct must not usehir-tytypes, onlyhirtypes.ide-diagnostics/src/handlers/for the diagnostic (follow existing handlers). A simple handler can take a few lines. Also add some tests.ide-diagnostics/src/lib.rs.That's it! You can also of course customize the error message to be clearer/clever, and/or add a fix, but that is good enough.