Skip to content

Lifetime variance fixes for clippy #97289

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
merged 1 commit into from
May 24, 2022

Conversation

compiler-errors
Copy link
Member

#97287 migrates rustc to a Ty type that is invariant over its lifetime 'tcx, so I need to fix a bunch of places that assume that Ty<'a> and Ty<'b> can be shortened to some common lifetime.

This is doable, since everything is already 'tcx, so all this PR does is be a bit more explicit that elided lifetimes are actually 'tcx.

Split out from #97287 so the clippy team can review independently.

@rust-highfive
Copy link
Contributor

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive
Copy link
Contributor

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 22, 2022
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

compiler-errors commented May 22, 2022

that's an embarrassing copy mistake

@apiraino apiraino added the A-clippy Area: Clippy label May 23, 2022
/// or at least call `.expect(_)` with a more helpful message. Still, for a lot of
/// quick-and-dirty code, `unwrap` is a good choice, which is why this lint is
/// or at least call `.expect(_)` with _tcx more helpful message. Still, for _tcx lot of
/// quick-and-dirty code, `unwrap` is _tcx good choice, which is why this lint is
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this was a search and replace gone wrong?

@Mark-Simulacrum
Copy link
Member

I commented on one case but it looks like there are a few more at least where 'a' is replaced with _tcx in comments etc

@Mark-Simulacrum Mark-Simulacrum 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-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2022
@compiler-errors compiler-errors force-pushed the tcxify-clippy branch 2 times, most recently from 2ae5732 to 8983f54 Compare May 23, 2022 15:56
@compiler-errors
Copy link
Member Author

Don't know how every a turned into _tcx in exactly one clippy file, but that's fixed. The changes are a lot shorter now too. Sorry for the mistakes.

@rustbot ready

@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 May 23, 2022
@Mark-Simulacrum
Copy link
Member

r=me modulo comment (either way)

@compiler-errors
Copy link
Member Author

@bors r=Mark-Simulacrum

@bors
Copy link
Collaborator

bors commented May 23, 2022

📌 Commit 215decd has been approved by Mark-Simulacrum

@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 May 23, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request May 24, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#97240 (Typo suggestion for a variable with a name similar to struct fields)
 - rust-lang#97289 (Lifetime variance fixes for clippy)
 - rust-lang#97290 (Turn on `fast_submodules` unconditionally)
 - rust-lang#97336 (typo)
 - rust-lang#97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3157e1f into rust-lang:master May 24, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 24, 2022
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 4, 2022
…rk-Simulacrum

Lifetime variance fixes for clippy

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the clippy team can review independently.
@compiler-errors compiler-errors deleted the tcxify-clippy branch August 11, 2023 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants