Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate rustc_attr crate diagnostics #100836

Merged
merged 9 commits into from
Aug 27, 2022

Conversation

hampuslidin
Copy link
Contributor

@hampuslidin hampuslidin commented Aug 21, 2022

Hi!

This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable.

@rustbot label +A-translation

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 21, 2022
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jackh726 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 21, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@hampuslidin hampuslidin force-pushed the migrate-attr-crate-diagnostics branch from 63f1b6a to 26b6c31 Compare August 21, 2022 19:53
@rust-log-analyzer

This comment has been minimized.

@hampuslidin
Copy link
Contributor Author

I think this PR is ready for review. There are a couple of FIXMEs in there I’d like some feedback on.

@hampuslidin hampuslidin marked this pull request as ready for review August 21, 2022 21:26
@rustbot
Copy link
Collaborator

rustbot commented Aug 21, 2022

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@hampuslidin
Copy link
Contributor Author

r? rust-lang/diagnostics

@bors

This comment was marked as resolved.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@davidtwco
Copy link
Member

r=me after rebase

@hampuslidin hampuslidin force-pushed the migrate-attr-crate-diagnostics branch from dce52fb to afd3476 Compare August 22, 2022 18:20
@hampuslidin
Copy link
Contributor Author

Rebased!

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 23, 2022

📌 Commit afd3476 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 23, 2022
@davidtwco davidtwco mentioned this pull request Aug 23, 2022
84 tasks
@compiler-errors
Copy link
Member

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 27, 2022
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#100724 (Migrate ast lowering to session diagnostic)
 - rust-lang#100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - rust-lang#100738 (Diagnostics migr const eval)
 - rust-lang#100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - rust-lang#100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - rust-lang#100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - rust-lang#100836 (Migrate `rustc_attr` crate diagnostics)
 - rust-lang#100890 (Migrate rustc_driver to SessionDiagnostic)
 - rust-lang#100900 (on `region_errors.rs`)

Failed merges:

 - rust-lang#100831 (Migrate `symbol_mangling` module to new diagnostics structs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d97e616 into rust-lang:master Aug 27, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 27, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 23, 2023
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly

Suggested in rust-lang#116773 (review).

This `handle_errors` function is originally from rust-lang#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 (rust-lang#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`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 23, 2023
Rollup merge of rust-lang#117064 - dtolnay:handleerrors, r=cjgillot

Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly

Suggested in rust-lang#116773 (review).

This `handle_errors` function is originally from rust-lang#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 (rust-lang#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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants