Skip to content

Fix a few diagnostics#152328

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

Fix a few diagnostics#152328
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
JonathanBrouwer:fix_diags

Conversation

@JonathanBrouwer
Copy link
Contributor

@JonathanBrouwer JonathanBrouwer commented Feb 8, 2026

When working on the inline diagnostics conversion (#151366), I noticed that my script sometimes took the wrong message.
Because it didn't happen very often, I just fixed it manually when a uitest fails.

However I got paranoid that the script changed messages that were not covered by uitests, so I checked for all messages in the previous messages.ftl files, whether they occured at least once in the codebase. I found 3 messages that indeed were wrongly replaced by my script, fixed them, and added uitests to make sure this doesn't happen again :)

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)

@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, 2026
#[help(
"if you meant to call a macro, remove the `pub` and add a trailing `!` after the identifier"
)]
HelpMacro,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this one I can't find a way to trigger this help message (though I didn't try very hard)
At least I added an assertion for the message above :)

#[derive(Subdiagnostic)]
#[multipart_suggestion(
"you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code",
"you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}",
Copy link
Member

@lqd lqd Feb 8, 2026

Choose a reason for hiding this comment

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

hmm, is this correct? guarantee is in the parent diagnostic. If it is, it seems quite error-prone e.g. with respect to refactoring (or complicates checking the syntax at compile time I guess).

Copy link
Contributor Author

@JonathanBrouwer JonathanBrouwer Feb 8, 2026

Choose a reason for hiding this comment

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

This is correct, subdiagnostics can use variables from their parent diagnostic, and this message (and quite a few others) do!
This was already the case, I also don't like it, and want to fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also why subdiagnostics are currently exempted from the compile-time "do variables exist" check, again, was also already the case before my refactoring

Copy link
Member

Choose a reason for hiding this comment

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

great to hear, it'll help reduce this magic flexibility for the better, surely.

@jdonszelmann
Copy link
Contributor

Looks good to me, @bors r=jdonszelmann,lqd

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

📌 Commit 7c37cd6 has been approved by jdonszelmann,lqd

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 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 8, 2026
…zelmann,lqd

Fix a few diagnostics

When working on the inline diagnostics conversion (rust-lang#151366), I noticed that my script sometimes took the wrong message.
Because it didn't happen very often, I just fixed it manually when a uitest fails.

However I got paranoid that the script changed messages that were not covered by uitests, so I checked for all messages in the previous `messages.ftl` files, whether they occured at least once in the codebase. I found 3 messages that indeed were wrongly replaced by my script, fixed them, and added uitests to make sure this doesn't happen again :)

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #151455 (Fix `SourceFile::normalized_byte_pos`)
 - #152250 (Remove support for slugs in diagnostic messages)
 - #152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - #152328 (Fix a few diagnostics)
 - #151640 (Cleanup offload datatransfer)
 - #152212 (Port some attributes to the attr parser)
 - #152309 (Fix bound var resolution for trait aliases)
@JonathanBrouwer
Copy link
Contributor Author

@bors r-
#152345 (comment)

@rust-bors rust-bors bot 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 Feb 8, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

Commit 7c37cd6 has been unapproved.

This PR was contained in a rollup (#152345), which was also unapproved.

@JonathanBrouwer
Copy link
Contributor Author

Right, before_exec is unix only, oops

@JonathanBrouwer
Copy link
Contributor Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
Fix a few diagnostics


try-job: test-various
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

☀️ Try build successful (CI)
Build commit: 3bc2a5e (3bc2a5e7814875c9a18d4d7dc11739d0e487fbe9, parent: 286fbe5d84569c718f189122db9e68a16b50eeef)

@JonathanBrouwer
Copy link
Contributor Author

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

📌 Commit d14c26f 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 8, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #151455 (Fix `SourceFile::normalized_byte_pos`)
 - #152250 (Remove support for slugs in diagnostic messages)
 - #152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - #152328 (Fix a few diagnostics)
 - #151640 (Cleanup offload datatransfer)
 - #152212 (Port some attributes to the attr parser)
 - #152309 (Fix bound var resolution for trait aliases)
 - #152339 (diagnostics: fix ICE in closure signature mismatch)
 - #152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
@JonathanBrouwer
Copy link
Contributor Author

Oops, this is supposed to be
@bors r=jdonszelmann,lqd

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

📌 Commit d14c26f has been approved by jdonszelmann,lqd

It is now in the queue for this repository.

@lqd
Copy link
Member

lqd commented Feb 8, 2026

I'm more surprised by the fact that old bors used to report when a commit that was already approved was reapproved. (It's not worth recreating the rollup to pick up the new reviewers, but thanks for thinking of our internet points 🙃)

@rust-bors rust-bors bot merged commit 0d9b0ab into rust-lang:main Feb 8, 2026
12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 8, 2026
rust-timer added a commit that referenced this pull request Feb 8, 2026
Rollup merge of #152328 - JonathanBrouwer:fix_diags, r=JonathanBrouwer

Fix a few diagnostics

When working on the inline diagnostics conversion (#151366), I noticed that my script sometimes took the wrong message.
Because it didn't happen very often, I just fixed it manually when a uitest fails.

However I got paranoid that the script changed messages that were not covered by uitests, so I checked for all messages in the previous `messages.ftl` files, whether they occured at least once in the codebase. I found 3 messages that indeed were wrongly replaced by my script, fixed them, and added uitests to make sure this doesn't happen again :)

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
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