Skip to content

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Aug 23, 2025

Fixes #145772

This PR changes the primary span(s) of the MISMATCHED_LIFETIME_SYNTAXES to point to the unnamed lifetime spans in both the inputs and outputs of the function signature. As reported in #145772, this should make it so that IDEs highlight the spans of the actionable part of this lint, rather than just the (possibly named) input spans like they do today.

This could be tweaked further perhaps, for example for fn foo(_: T<'_>) -> T, we don't need to highlight the elided lifetime if the actionable part is to change only the return type to T<'_>, but I think it's improvement on what's here today, so I think that should be follow-up since I think the logic might get a bit hairy.

cc @shepmaster

@rustbot
Copy link
Collaborator

rustbot commented Aug 23, 2025

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
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

@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 Aug 23, 2025
@rust-log-analyzer

This comment has been minimized.

@lqd
Copy link
Member

lqd commented Aug 23, 2025

Nice improvement indeed, r=me with CI fixed; it looks like clippy tests need to be blessed

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Aug 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 23, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

Ok for the Clippy part

View changes since this review

@compiler-errors
Copy link
Member Author

@bors r=lqd rollup

@bors
Copy link
Collaborator

bors commented Aug 24, 2025

📌 Commit e4557f0 has been approved by lqd

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 Aug 24, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 24, 2025
…, r=lqd

Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`

Fixes rust-lang#145772

This PR changes the primary span(s) of the `MISMATCHED_LIFETIME_SYNTAXES` to point to the *unnamed* lifetime spans in both the inputs and *outputs* of the function signature. As reported in rust-lang#145772, this should make it so that IDEs highlight the spans of the actionable part of this lint, rather than just the (possibly named) input spans like they do today.

This could be tweaked further perhaps, for example for `fn foo(_: T<'_>) -> T`, we don't need to highlight the elided lifetime if the actionable part is to change only the return type to `T<'_>`, but I think it's improvement on what's here today, so I think that should be follow-up since I think the logic might get a bit hairy.

cc `@shepmaster`
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 24, 2025
…, r=lqd

Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`

Fixes rust-lang#145772

This PR changes the primary span(s) of the `MISMATCHED_LIFETIME_SYNTAXES` to point to the *unnamed* lifetime spans in both the inputs and *outputs* of the function signature. As reported in rust-lang#145772, this should make it so that IDEs highlight the spans of the actionable part of this lint, rather than just the (possibly named) input spans like they do today.

This could be tweaked further perhaps, for example for `fn foo(_: T<'_>) -> T`, we don't need to highlight the elided lifetime if the actionable part is to change only the return type to `T<'_>`, but I think it's improvement on what's here today, so I think that should be follow-up since I think the logic might get a bit hairy.

cc ``@shepmaster``
bors added a commit that referenced this pull request Aug 24, 2025
Rollup of 6 pull requests

Successful merges:

 - #144531 (Add lint against integer to pointer transmutes)
 - #144885 (Implement some more checks in `ptr_guaranteed_cmp`. )
 - #145307 (Fix `LazyLock` poison panic message)
 - #145554 (rustc-dev-guide subtree update)
 - #145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`)
 - #145799 (std/src/lib.rs: mention "search button" instead of "search bar")

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 24, 2025
Rollup of 5 pull requests

Successful merges:

 - #144531 (Add lint against integer to pointer transmutes)
 - #145307 (Fix `LazyLock` poison panic message)
 - #145554 (rustc-dev-guide subtree update)
 - #145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`)
 - #145799 (std/src/lib.rs: mention "search button" instead of "search bar")

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ccfe968 into rust-lang:master Aug 24, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 24, 2025
rust-timer added a commit that referenced this pull request Aug 24, 2025
Rollup merge of #145798 - compiler-errors:unnamed-lt-primary, r=lqd

Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`

Fixes #145772

This PR changes the primary span(s) of the `MISMATCHED_LIFETIME_SYNTAXES` to point to the *unnamed* lifetime spans in both the inputs and *outputs* of the function signature. As reported in #145772, this should make it so that IDEs highlight the spans of the actionable part of this lint, rather than just the (possibly named) input spans like they do today.

This could be tweaked further perhaps, for example for `fn foo(_: T<'_>) -> T`, we don't need to highlight the elided lifetime if the actionable part is to change only the return type to `T<'_>`, but I think it's improvement on what's here today, so I think that should be follow-up since I think the logic might get a bit hairy.

cc ```@shepmaster```
@jhpratt
Copy link
Member

jhpratt commented Aug 24, 2025

still in queue

@bors r-

github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Aug 25, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144531 (Add lint against integer to pointer transmutes)
 - rust-lang/rust#145307 (Fix `LazyLock` poison panic message)
 - rust-lang/rust#145554 (rustc-dev-guide subtree update)
 - rust-lang/rust#145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`)
 - rust-lang/rust#145799 (std/src/lib.rs: mention "search button" instead of "search bar")

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 25, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144531 (Add lint against integer to pointer transmutes)
 - rust-lang/rust#145307 (Fix `LazyLock` poison panic message)
 - rust-lang/rust#145554 (rustc-dev-guide subtree update)
 - rust-lang/rust#145798 (Use unnamed lifetime spans as primary spans for `MISMATCHED_LIFETIME_SYNTAXES`)
 - rust-lang/rust#145799 (std/src/lib.rs: mention "search button" instead of "search bar")

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-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.

mismatched_lifetime_syntaxes location should be on the type I need to change
8 participants