Skip to content

Add inline syntax for diagnostic messages#151872

Merged
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
JonathanBrouwer:diag3
Feb 3, 2026
Merged

Add inline syntax for diagnostic messages#151872
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
JonathanBrouwer:diag3

Conversation

@JonathanBrouwer
Copy link
Contributor

@JonathanBrouwer JonathanBrouwer commented Jan 30, 2026

This PR adds the new inline diagnostics syntax needed for #151366.
The syntax itself is briefly described in the MCP: rust-lang/compiler-team#959

To test these changes:

r? @Kivooeo

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 30, 2026
@JonathanBrouwer JonathanBrouwer marked this pull request as ready for review February 1, 2026 10:13
@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2026

rustc_errors::translation was changed

cc @davidtwco, @TaKO8Ki

rustc_error_messages was changed

cc @davidtwco, @TaKO8Ki

rustc_macros::diagnostics was changed

cc @davidtwco, @TaKO8Ki

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 1, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Feb 2, 2026

is this affect perf somehow? implementation wise it looks fine

@JonathanBrouwer
Copy link
Contributor Author

@Kivooeo Most of the changed code runs in a proc macro, so this can't affect performance.

The changes in compiler/rustc_errors/src/translation.rs could theoretically affect performance, but since no actual diagnostics use this code yet running rust-timer here does not make sense. I expect there to be no effect on performance since diagnostics are not perf-sensitive

@Kivooeo
Copy link
Member

Kivooeo commented Feb 2, 2026

good to know, then i guess i could sign this off, thanks for working on it!

im no expecting this to break anything, so rollup

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 2, 2026

📌 Commit ca2be71 has been approved by Kivooeo

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

Rollup of 12 pull requests

Successful merges:

 - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports)
 - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive)
 - #151938 (Use `#![feature(adt_const_params)]` for static query flags)
 - #151172 (Use default field values in a few more cases)
 - #151825 (more float constants)
 - #151870 (regression test for alias-relate changes in lub)
 - #151872 (Add inline syntax for diagnostic messages)
 - #151902 (explain why we dont skip some of this work when there are field projections)
 - #151909 (Skip overlapping spans in argument error suggestions)
 - #151978 (Query cleanups)
 - #151979 (Fix uninitialized UEFI globals in tests)
 - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 2, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports)
 - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive)
 - #151938 (Use `#![feature(adt_const_params)]` for static query flags)
 - #151172 (Use default field values in a few more cases)
 - #151825 (more float constants)
 - #151870 (regression test for alias-relate changes in lub)
 - #151872 (Add inline syntax for diagnostic messages)
 - #151902 (explain why we dont skip some of this work when there are field projections)
 - #151909 (Skip overlapping spans in argument error suggestions)
 - #151978 (Query cleanups)
 - #151979 (Fix uninitialized UEFI globals in tests)
 - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 3, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports)
 - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive)
 - #151938 (Use `#![feature(adt_const_params)]` for static query flags)
 - #151172 (Use default field values in a few more cases)
 - #151825 (more float constants)
 - #151870 (regression test for alias-relate changes in lub)
 - #151872 (Add inline syntax for diagnostic messages)
 - #151902 (explain why we dont skip some of this work when there are field projections)
 - #151909 (Skip overlapping spans in argument error suggestions)
 - #151978 (Query cleanups)
 - #151979 (Fix uninitialized UEFI globals in tests)
 - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
@rust-bors rust-bors bot merged commit 5e1db44 into rust-lang:main Feb 3, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 3, 2026
rust-timer added a commit that referenced this pull request Feb 3, 2026
Rollup merge of #151872 - JonathanBrouwer:diag3, r=Kivooeo

Add inline syntax for diagnostic messages

This PR adds the new inline diagnostics syntax needed for #151366.
The syntax itself is briefly described in the MCP: rust-lang/compiler-team#959

To test these changes:
* I added quite a few uitests
* I converted the first crate `rustc_attr_parsing` to the new syntax in a separate PR: #151944

r? @Kivooeo
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.

4 participants