-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unify all uses of 'gcx and 'tcx. #61817
Conversation
@bors treeclosed=500 |
@bors treeclosed- That was a bit premature 🤣 |
This comment has been minimized.
This comment has been minimized.
efcb742
to
b532515
Compare
This comment has been minimized.
This comment has been minimized.
b532515
to
94cfb14
Compare
Review has started, let's get the ball rolling: @bors treeclosed=500 |
@bors p=700 (oops, forgot to also set this) |
@eddyb When this whole transition is over, could you please update the rustc-guide (or tell me how to)? |
94cfb14
to
afc39bb
Compare
@mark-i-m Definitely! Not sure if I can do it today, sadly. I guess I could open the PR now and someone cam merge it once this PR is merged. @oli-obk Oops! There were two instances of that, probably a VSCode stale file during mass-replacement (those changes look like something I did on a different branch but they never made it into a PR). |
@bors r+ |
📌 Commit afc39bb has been approved by |
Unify all uses of 'gcx and 'tcx. This is made possible by @Zoxc landing #57214 (see #57214 (comment) for the decision). A bit of context for the approach: just like #61722, this is *not* how I originally intended to go about this, but @Zoxc and my own experimentation independently resulted in the same conclusion: The interim alias `type TyCx<'tcx> = TyCtxt<'tcx, 'tcx>;` attempt required more work (adding `use`s), even only for handling the `TyCtxt<'tcx, 'tcx>` case and not the general `TyCtxt<'gcx, 'tcx>` one. What this PR is based on is the realization that `'gcx` is a special-enough name that it can be replaced, without caring for context, with `'tcx`, and then repetitions of the name `'tcx` be compacted away. After that, only a small number of error categories remained, each category easily dealt with with either more mass replacements (e.g. `TyCtxt<'tcx, '_>` -> `TyCtxt<'tcx>`) or by hand. For the `rustfmt` commit, I used rust-lang/rustfmt#1324 (comment), and manually filtered out some noise, like in #61735 and #61722, and like the latter, there was also a weird bug to work around. It should be reviewed separately, and dropped if unwanted (in this PR it's pretty significant). cc @rust-lang/compiler r? @nikomatsakis
-> DepNode | ||
where 'gcx: 'a + 'tcx, | ||
where 'tcx: 'a, | ||
'tcx: 'a |
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.
There's still some redundancy here, do you plan to clean up later?
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.
there are a few others, they will often be detected by various lints that are still in the process of getting fixed so they have no false positives
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.
Yeah (although everyone is free to try, there really isn't that much).
I only removed the cases where it was causing an error, I guess my mistake was matching on the exact number of spaces instead of \s+
.
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.
In general we should start removing lifetime bounds except in the rare cases when they're needed.
Fix wrong lifetime of TyCtxt Rustup rust-lang/rust#61817 changelog: none
☀️ Test successful - checks-travis, status-appveyor |
📣 Toolstate changed by #61817! Tested on commit 9606f6f. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). |
Tested on commit rust-lang/rust@9606f6f. Direct link to PR: <rust-lang/rust#61817> 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
@bors treeclosed- |
Fix wrong lifetime of TyCtxt Rustup rust-lang/rust#61817 changelog: none
This is made possible by @Zoxc landing #57214 (see #57214 (comment) for the decision).
A bit of context for the approach: just like #61722, this is not how I originally intended to go about this, but @Zoxc and my own experimentation independently resulted in the same conclusion:
The interim alias
type TyCx<'tcx> = TyCtxt<'tcx, 'tcx>;
attempt required more work (addinguse
s), even only for handling theTyCtxt<'tcx, 'tcx>
case and not the generalTyCtxt<'gcx, 'tcx>
one.What this PR is based on is the realization that
'gcx
is a special-enough name that it can be replaced, without caring for context, with'tcx
, and then repetitions of the name'tcx
be compacted away.After that, only a small number of error categories remained, each category easily dealt with with either more mass replacements (e.g.
TyCtxt<'tcx, '_>
->TyCtxt<'tcx>
) or by hand.For the
rustfmt
commit, I used rust-lang/rustfmt#1324 (comment), and manually filtered out some noise, like in #61735 and #61722, and like the latter, there was also a weird bug to work around.It should be reviewed separately, and dropped if unwanted (in this PR it's pretty significant).
cc @rust-lang/compiler r? @nikomatsakis