-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-toolsA meta category for issues that should be addressed by tooling (prefer more concrete areas).A meta category for issues that should be addressed by tooling (prefer more concrete areas).type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
One very useful feature Macros proposed was the ability to emit custom errors/warnings.
This was helpful because code-generators often have some form of error cases.
Since macros are cancelled, could we maybe have some dumbed down version of this?
Proposal: A custom comment similar to // ignore for emitting diagnostics
One way generators could emit diagnostics could be through comments.
For example, we could imagine a generator output:
// @diagnostic kind=error line=10 colum=5 message="You must provide a constuctor"This would output an error in the associated file, with the given parameters.
Bonus: Have build or source_gen automatically emit such comment when an exception is thrown by generators
Currently, generators rely on throwing InvalidSourceException to emit similar error reports.
The generation tooling could catch those and output a corresponding // @diagnostic,
Metadata
Metadata
Assignees
Labels
area-toolsA meta category for issues that should be addressed by tooling (prefer more concrete areas).A meta category for issues that should be addressed by tooling (prefer more concrete areas).type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug