diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-23 16:23:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-23 16:23:53 +0200 |
| commit | 6814eb1052e712346a6bab6bb5ef63f38d298378 (patch) | |
| tree | 62c4dc5c22899208ab2ae918d59c0dc14ac231f0 /compiler/rustc_codegen_llvm/src | |
| parent | 46d7038b03953af7669acf2f25a4f27c6e525715 (diff) | |
| parent | 28785291f95e933829c4e86bcf7d6547f5ff3aa8 (diff) | |
| download | rust-6814eb1052e712346a6bab6bb5ef63f38d298378.tar.gz rust-6814eb1052e712346a6bab6bb5ef63f38d298378.zip | |
Rollup merge of #117064 - dtolnay:handleerrors, r=cjgillot
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly
Suggested in https://github.com/rust-lang/rust/pull/116773#pullrequestreview-1691411257.
This `handle_errors` function is originally from https://github.com/rust-lang/rust/pull/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 (https://github.com/rust-lang/rust/pull/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`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
