Skip to content

Reword mismatched-lifetime-syntaxes text based on feedback #143914

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shepmaster
Copy link
Member

Key changes include:

  • Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier.
  • The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new help line is general across the mismatch kinds.
  • Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects.
  • Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.

r? @jieyouxu

@shepmaster shepmaster added the L-mismatched_lifetime_syntaxes Lint: mismatched_lifetime_syntaxes label Jul 14, 2025
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 14, 2025
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

I'll look at this on Wednesday.

@shepmaster shepmaster force-pushed the mismatched-lifetime-syntaxes-rewording branch from 677cf7b to 14baad4 Compare July 14, 2025 13:34
Key changes include:

- Removal of the word "syntax" from the lint message. More accurately,
  it could have been something like "syntax group" or "syntax
  category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is
  occurring, instead of trying to be general. A new `help` line is
  general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also
  changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't
  occur in that specific suggestion.
@shepmaster shepmaster force-pushed the mismatched-lifetime-syntaxes-rewording branch from 14baad4 to 5530744 Compare July 14, 2025 15:30
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-up! At least for me, I find this revised wording and diagnostics much clearer in terms of "why is this a problem" and "what am I expected to do".

Comment on lines +511 to +524
error: hiding or eliding a lifetime that's named elsewhere is confusing
--> $DIR/mismatched-lifetime-syntaxes.rs:232:53
|
LL | fn all_three_categories<'a>(v: ContainsLifetime<'a>) -> (&u8, ContainsLifetime) {
| ^^ --- ---------------- the same lifetime is hidden here
| | |
| | the same lifetime is elided here
| the lifetime is named here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: consistently use `'a`
|
LL | fn all_three_categories<'a>(v: ContainsLifetime<'a>) -> (&'a u8, ContainsLifetime<'a>) {
| ++ ++++
Copy link
Member

Choose a reason for hiding this comment

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

Remark: this is very nice :)

@shepmaster shepmaster marked this pull request as ready for review July 16, 2025 16:23
@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 Jul 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@shepmaster
Copy link
Member Author

/cc @traviscross. Since you effectively proposed the wording in this PR, I'm going to assume that you also approve of it. We've got an approval from the compiler team, so I'm inclined to merge this sooner rather than later so it can get beta-nominated faster.

@shepmaster shepmaster added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 16, 2025
@jieyouxu
Copy link
Member

r? @traviscross (for wording)

@rustbot rustbot assigned traviscross and unassigned jieyouxu Jul 16, 2025
@shepmaster
Copy link
Member Author

I'm also going to jump the gun here and nominate for this to be backported to beta. The current wording has been reported to be suboptimal, so hopefully we can skip having a 6-week period of confusion. If not, it wouldn't be the end of the world.

Copy link
Contributor

@traviscross traviscross left a comment

Choose a reason for hiding this comment

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

Thanks @shepmaster for making these updates.

@jieyouxu
Copy link
Member

Oh I forgot to say, impl looks good, so r=me on the impl side.

@shepmaster
Copy link
Member Author

@bors r=traviscross,jieyouxu rollup

@bors
Copy link
Collaborator

bors commented Jul 16, 2025

📌 Commit 5530744 has been approved by traviscross,jieyouxu

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 16, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 16, 2025
…taxes-rewording, r=traviscross,jieyouxu

Reword mismatched-lifetime-syntaxes text based on feedback

Key changes include:

- Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.

r? `@jieyouxu`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 16, 2025
…taxes-rewording, r=traviscross,jieyouxu

Reword mismatched-lifetime-syntaxes text based on feedback

Key changes include:

- Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.

r? ``@jieyouxu``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 16, 2025
…taxes-rewording, r=traviscross,jieyouxu

Reword mismatched-lifetime-syntaxes text based on feedback

Key changes include:

- Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.

r? ```@jieyouxu```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-nominated Nominated for backporting to the compiler in the beta channel. L-mismatched_lifetime_syntaxes Lint: mismatched_lifetime_syntaxes S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. 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