-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Use unnamed lifetime spans as primary spans for MISMATCHED_LIFETIME_SYNTAXES
#145798
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
Nice improvement indeed, r=me with CI fixed; it looks like clippy tests need to be blessed |
9807507
to
e4557f0
Compare
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
samueltardieu
approved these changes
Aug 23, 2025
There was a problem hiding this 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
@bors r=lqd rollup |
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
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```
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toT<'_>
, 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