Skip to content

Unify all uses of 'gcx and 'tcx. - #61817

Merged
bors merged 2 commits into
rust-lang:masterfrom
eddyb:begone-gcx-attempt-2
Jun 14, 2019
Merged

Unify all uses of 'gcx and 'tcx.#61817
bors merged 2 commits into
rust-lang:masterfrom
eddyb:begone-gcx-attempt-2

Conversation

@eddyb

@eddybeddyb commented Jun 13, 2019

Copy link
Copy Markdown
Contributor

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 uses), 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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 13, 2019
@Centril

Copy link
Copy Markdown
Contributor

@bors treeclosed=500

@Centril

Copy link
Copy Markdown
Contributor

@bors treeclosed-

That was a bit premature 🤣

@rust-highfive

This comment has been minimized.

@eddyb
eddybforce-pushed the begone-gcx-attempt-2 branch from efcb742 to b532515CompareJune 14, 2019 01:02
@rust-highfive

This comment has been minimized.

@eddyb
eddybforce-pushed the begone-gcx-attempt-2 branch from b532515 to 94cfb14CompareJune 14, 2019 14:03
@nikomatsakisnikomatsakis mentioned this pull request Jun 14, 2019
4 tasks
@eddyb

Copy link
Copy Markdown
ContributorAuthor

Review has started, let's get the ball rolling: @bors treeclosed=500

@eddyb

Copy link
Copy Markdown
ContributorAuthor

@bors p=700 (oops, forgot to also set this)

@mark-i-m

Copy link
Copy Markdown
Contributor

@eddyb When this whole transition is over, could you please update the rustc-guide (or tell me how to)?

@eddyb
eddybforce-pushed the begone-gcx-attempt-2 branch from 94cfb14 to afc39bbCompareJune 14, 2019 16:00
@eddyb

Copy link
Copy Markdown
ContributorAuthor

@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).
I've force-pushed with them removed.

@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 14, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit afc39bb has been approved by oli-obk

@borsbors 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 Jun 14, 2019
@bors

bors commented Jun 14, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit afc39bb with merge 9606f6f...

bors added a commit that referenced this pull request Jun 14, 2019
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

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
ContributorAuthor

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

Copy link
Copy Markdown
ContributorAuthor

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.

@ehussehuss mentioned this pull request Jun 14, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jun 14, 2019
@bors

bors commented Jun 14, 2019

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 9606f6f to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jun 14, 2019
@bors
bors merged commit afc39bb into rust-lang:masterJun 14, 2019
@rust-highfive

Copy link
Copy Markdown
Contributor

📣 Toolstate changed by #61817!

Tested on commit 9606f6f.
Direct link to PR: #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).

@borsbors mentioned this pull request Jun 14, 2019
rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jun 14, 2019
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).
@eddyb
eddyb deleted the begone-gcx-attempt-2 branch June 14, 2019 19:09
@matthewjasper

Copy link
Copy Markdown
Contributor

@bors treeclosed-

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: 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.

9 participants

@eddyb@Centril@rust-highfive@mark-i-m@oli-obk@bors@matthewjasper@RalfJung@nikomatsakis