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

Reorder diagnostics API #120765

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Reorder diagnostics API #120765

merged 2 commits into from
Feb 12, 2024

Conversation

nnethercote
Copy link
Contributor

The totally random ordering of diagnostic methods in DiagCtxt has been low-key driving me crazy for a while now.

r? @compiler-errors

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 8, 2024
@nnethercote
Copy link
Contributor Author

Here's the API summary table I've been using for a while now, which I used to guide this PR.

func                        args     ret          create/struct internals
----                    -----------  ---          -----------------------
{struct_,}bug               msg      DB<BA> / !   DB::new(BugAbort)
{struct_,}span_bug      sp, msg      DB<BA> / !   struct_bug + with_span
{create,emit}_bug           err      DB<BA> / !   .into_diagnostic

{struct_,}fatal             msg      DB<FA> / !   DB::new(FatalAbort)
{struct_,}span_fatal    sp, msg      DB<FA> / !   struct_fatal + with_span
{create,emit}_fatal         err      DB<FA> / !   .into_diagnostic

{create,emit}_almost_fatal  err      DB<FE> / FE  .into_diagnostic

{struct_,}err               msg      DB<>   / EG  DB::new(Error)
{struct_,}span_err      sp, msg      DB<>   / EG  struct_err + with_span
{create,emit}_err           err      DB<>   / EG  .into_diagnostic 

  delayed_bug               msg      -      / EG  DB::new(DelayedBug)) [*]
  span_delayed_bug      sp, msg      -      / EG  DB::new(DelayedBug) + with_span [*]

  good_path_delayed_bug     msg      -      / ()  DB::new(GoodPathDelayedBug) + emit [*]
                                                                 
{struct_,}warn              msg      DB<()> / ()  DB::new(Warning)
{struct_,}span_warn     sp, msg      DB<()> / ()  struct_warn + with_span
{create,emit}_warn          err      DB<()> / ()  .into_diagnostic 

{struct_,}note              msg      DB<()> / ()  DB::new(Note)  
{struct_,}span_note     sp, msg      DB<()> / ()  struct_note + with_span
{create,emit}_note          err      DB<()> / ()  .into_diagnostic 

struct_help                 msg      DB<()>       DB::new(Help) 

struct_allow                msg      DB<()>       DB::new(Allow) 

struct_expect               msg, id  DB<()>       DB::new(Expect(id))

@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 8, 2024

📌 Commit d1920a7 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 Feb 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2024
…mpiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2024
…mpiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? ``@compiler-errors``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2024
…mpiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? ```@compiler-errors```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2024
…mpiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? ````@compiler-errors````
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#113026 (Introduce `run-make` V2 infrastructure, a `run_make_support` library and port over 2 tests as example)
 - rust-lang#120589 (std::thread::available_parallelism merging linux/android/freebsd version)
 - rust-lang#120590 (Remove unused args from functions)
 - rust-lang#120596 ([rustdoc] Correctly generate path for non-local items in source code pages)
 - rust-lang#120693 (Invert diagnostic lints.)
 - rust-lang#120704 (A drive-by rewrite of `give_region_a_name()`)
 - rust-lang#120750 (No need to take `ImplTraitContext` by ref)
 - rust-lang#120765 (Reorder diagnostics API)
 - rust-lang#120772 (Remove myself from review rotation.)
 - rust-lang#120783 (Add release note for new ambiguous_wide_pointer_comparisons lint)

Failed merges:

 - rust-lang#120782 (Fix mir pass ICE in the presence of other errors)

r? `@ghost`
`@rustbot` modify labels: rollup
The current order is almost perfectly random. This commit puts them into
a predictable order in their own impl block, going from the highest
level (`Block`) to the lowest (`Expect`). Within each level this is the
order:

- struct_err, err
- struct_span_err, span_err
- create_err, emit_err

The first one in each pair creates a diagnostic, the second one creates
*and* emits a diagnostic. Not every method is present for every level.

The diff is messy, but other than moving methods around, the only thing
it does is create the new `impl DiagCtxt` block with its own comment.
- Remove low-value comments about functionality that is obvious.

- Add missing `track_caller` attributes -- every method should have one.

- Adjust `rustc_lint_diagnostic` attributes. Every method involving a
  `impl Into<DiagnosticMessage>` or `impl Into<SubdiangnosticMessage>`
  argument should have one, except for those producing bugs, which
  aren't user-facing.
@nnethercote
Copy link
Contributor Author

I fixed the conflicts.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Feb 11, 2024

📌 Commit b7b6ebc has been approved by compiler-errors

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 12, 2024
…mpiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#120765 (Reorder diagnostics API)
 - rust-lang#120833 (More internal emit diagnostics cleanups)
 - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`)
 - rust-lang#120917 (Remove a bunch of dead parameters in functions)
 - rust-lang#120928 (Add test for recently fixed issue)
 - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent)
 - rust-lang#120936 (improve `btree_cursors` functions documentation)
 - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct)
 - rust-lang#120956 (Clean inlined type alias with correct param-env)
 - rust-lang#120962 (Add myself to library/std review)
 - rust-lang#120972 (fix ICE for deref coercions with type errors)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 57a2e91 into rust-lang:master Feb 12, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2024
Rollup merge of rust-lang#120765 - nnethercote:reorder-diag-API, r=compiler-errors

Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? ``@compiler-errors``
@nnethercote nnethercote deleted the reorder-diag-API branch February 12, 2024 20:23
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 26, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#120765 (Reorder diagnostics API)
 - rust-lang#120833 (More internal emit diagnostics cleanups)
 - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`)
 - rust-lang#120917 (Remove a bunch of dead parameters in functions)
 - rust-lang#120928 (Add test for recently fixed issue)
 - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent)
 - rust-lang#120936 (improve `btree_cursors` functions documentation)
 - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct)
 - rust-lang#120956 (Clean inlined type alias with correct param-env)
 - rust-lang#120962 (Add myself to library/std review)
 - rust-lang#120972 (fix ICE for deref coercions with type errors)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants