-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #117064 - dtolnay:handleerrors, r=cjgillot
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly Suggested in #116773 (review). This `handle_errors` function is originally from #34531, in which it was useful because it allowed error messages and error codes (`E0542`) for multiple occurrences of the same error to be centralized in one place. For example rather than repeating this diagnostic in 2 places: ```rust span_err!(diagnostic, attr.span, E0542, "missing 'since'"); ``` one could repeat this instead: ```rust handle_errors(diagnostic, attr.span, AttrError::MissingSince); ``` ensuring that all "missing 'since'" errors always remained consistent in message and error code. Over time as error messages and error codes got factored to fluent diagnostics (#100836), this rationale no longer applies. The new code has the same benefit while being less verbose (+73, -128). ```rust sess.emit_err(session_diagnostics::MissingSince { span: attr.span }); ``` r? `@cjgillot`
- Loading branch information
Showing
1 changed file
with
73 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters