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 some of rustc_passes::check_attr's diagnostics and derive improvements #99213

Merged
merged 5 commits into from
Jul 16, 2022

Conversation

davidtwco
Copy link
Member

  • Implements IntoDiagnosticArg for char using its Debug implementation and introduces a macro for those types which just delegate the implementation to ToString.
  • Apply the #[rustc_lint_diagnostics] attribute to LintDiagnosticBuilder::build so that diagnostic migration lints will trigger for it - some diagnostics in rustc_privacy need updated after this since the lints apply to that crate.
  • Add support for MultiSpan with any of the attributes that work on a Span in the diagnostic derive (SessionDiagnostic + LintDiagnostic). Requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in.
  • Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the warn attribute already existing, so this name being unavailable for the derives to use. #[warn_] is used instead, which requires special-casing so that {span_,}warn is called instead of {span_,}warn_.
  • Migrate half of the rustc_passes::check_attr diagnostics to using diagnostic derives and being translatable. I got tired after a while. I modified some diagnostic output for consistency while doing this, nothing too crazy.

r? @compiler-errors

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 13, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2022
@rust-log-analyzer

This comment was marked as resolved.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

These changes look fine. I would maybe like context on the questions I asked but otherwise r=me with changes or not.

@davidtwco
Copy link
Member Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jul 14, 2022

📌 Commit 505e7e7d94b3a168dad1c614cc2dfea76460b87a has been approved by compiler-errors

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 Jul 14, 2022
@bors

This comment was marked as resolved.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 15, 2022
Implements `IntoDiagnosticArg` for `char` using its `Debug`
implementation and introduces a macro for those types which just
delegate the implementation to `ToString`.

Signed-off-by: David Wood <[email protected]>
Apply the `#[rustc_lint_diagnostics]` attribute to
`LintDiagnosticBuilder::build` so that diagnostic migration lints will
trigger for it.

Signed-off-by: David Wood <[email protected]>
Add support for `MultiSpan` with any of the attributes that work on a
`Span` - requires that diagnostic logic generated for these attributes
are emitted in the by-move block rather than the by-ref block that they
would normally have been generated in.

Signed-off-by: David Wood <[email protected]>
Both diagnostic and subdiagnostic derives were missing the ability to
add warnings to diagnostics - this is made more difficult by the `warn`
attribute already existing, so this name being unavailable for the
derives to use. `#[warn_]` is used instead, which requires
special-casing so that `{span_,}warn` is called instead of
`{span_,}warn_`.

Signed-off-by: David Wood <[email protected]>
Migrate half of the `rustc_passes::check_attr` diagnostics to using
diagnostic derives and being translatable.
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 15, 2022

📌 Commit 78b19a9 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2022
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#98582 (Allow destructuring opaque types in their defining scopes)
 - rust-lang#99213 (migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements)
 - rust-lang#99258 (Provide structured suggestion for dropped temp value)
 - rust-lang#99259 (interpret/visitor: support visiting with a PlaceTy)
 - rust-lang#99287 ([rustdoc-json] JSON no longer inlines)
 - rust-lang#99290 (Revert "Highlight conflicting param-env candidates")
 - rust-lang#99316 (docs: add missing word)
 - rust-lang#99317 (Borrow Vec<T, A> as [T])
 - rust-lang#99323 (Fix flakyness of GUI tests)
 - rust-lang#99342 (Avoid some `Symbol` to `String` conversions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 79857a7 into rust-lang:master Jul 16, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 16, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 17, 2022
…te-passes, r=compiler-errors"

This reverts commit 79857a7, reversing
changes made to 6f8fb91.
@davidtwco davidtwco deleted the translation-migrate-passes branch July 18, 2022 07:45
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jul 27, 2022
…s-2, r=compiler-errors

passes: port more of `check_attr` module

Continues from rust-lang#99213.

Port more diagnostics in `rustc_passes::check_attr` to using the diagnostic derive and translation machinery.

r? `@compiler-errors`
@compiler-errors compiler-errors added the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Aug 11, 2022
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.

6 participants