Skip to content

Change api of formatting diagnostic attribute strings.#154858

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
mejrs:diagnostic_eval
Apr 6, 2026
Merged

Change api of formatting diagnostic attribute strings.#154858
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
mejrs:diagnostic_eval

Conversation

@mejrs
Copy link
Copy Markdown
Contributor

@mejrs mejrs commented Apr 5, 2026

As of recently a lot of people are creating new diagnostic attributes, but skipping its methods and doing things like directive.message.as_ref().map(|e| e.1.format(&args)), instead, but that skips the tracing instrumentation of diagnostic attribute formatting. The first commit forces people to use the right method for that.

The name OnUnimplementedNote also hasn't been accurate for some time.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 5, 2026

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Apr 5, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 5, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 11 candidates

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

r? me
Will review tomorrow :)

@rustbot rustbot assigned JonathanBrouwer and unassigned chenyukang Apr 5, 2026
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer left a comment

Choose a reason for hiding this comment

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

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 6, 2026

📌 Commit 7791ac7 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Apr 6, 2026
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #154554 (emit error on `#[track_caller]` with `extern fn`)
 - #154858 (Change api of formatting diagnostic attribute strings.)
 - #154876 (attr parsing: make sure we pass the right target when errors could be emitted)
) -> OnUnimplementedNote {
) -> CustomDiagnostic {
let this = &args.this;
info!("eval({self:?}, this={this}, options={condition_options:?}, args ={args:?})");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: does this need to be info! instead of say, debug!?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm yeah debug! is definitely more appropriate here, oops
@mejrs could you open a new pr to change it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rust-bors rust-bors bot merged commit cb3b8ff into rust-lang:main Apr 6, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 6, 2026
rust-timer added a commit that referenced this pull request Apr 6, 2026
Rollup merge of #154858 - mejrs:diagnostic_eval, r=JonathanBrouwer

Change api of formatting diagnostic attribute strings.

As of recently a lot of people are creating new diagnostic attributes, but skipping its methods and doing things like `directive.message.as_ref().map(|e| e.1.format(&args)),` instead, but that skips the `tracing` instrumentation of diagnostic attribute formatting. The first commit forces people to use the right method for that.

The name `OnUnimplementedNote` also hasn't been accurate for some time.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 6, 2026
rust-timer added a commit that referenced this pull request Apr 6, 2026
Rollup merge of #154898 - mejrs:info_to_debug, r=JonathanBrouwer

Use debug! instead of info!

re: #154858 (comment)

r? @JonathanBrouwer
cc @jieyouxu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

5 participants