Skip to content

Remove CrateNum parameter for queries that only work on local crate #85178

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 19 commits into from
May 17, 2021

Conversation

cjgillot
Copy link
Contributor

The pervasive CrateNum parameter is a remnant of the multi-crate rustc idea.

Using () as query key in those cases avoids having to worry about the validity of the query key.

@rust-highfive
Copy link
Contributor

Some changes occured to rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in intra-doc-links.

cc @jyn514

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive
Copy link
Contributor

r? @varkor

(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 11, 2021
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 11, 2021
@bors
Copy link
Collaborator

bors commented May 11, 2021

⌛ Trying commit 744dece9b42ec88e849099716a81b1a99bcfaab1 with merge f690672c840f1ece42fcb14f6143579ce2f69016...

@bors
Copy link
Collaborator

bors commented May 11, 2021

☀️ Try build successful - checks-actions
Build commit: f690672c840f1ece42fcb14f6143579ce2f69016 (f690672c840f1ece42fcb14f6143579ce2f69016)

@rust-timer
Copy link
Collaborator

Queued f690672c840f1ece42fcb14f6143579ce2f69016 with parent 506e75c, future comparison URL.

@marmeladema
Copy link
Contributor

I have tried something similar in #71648 but I gave up^^

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (f690672c840f1ece42fcb14f6143579ce2f69016): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 11, 2021
@Xanewok
Copy link
Member

Xanewok commented May 11, 2021

(...) remnant of the multi-crate rustc idea

Sorry for the noise here but is this idea abandoned/discussed recently somewhere?

@bors
Copy link
Collaborator

bors commented May 12, 2021

☔ The latest upstream changes (presumably #83610) made this pull request unmergeable. Please resolve the merge conflicts.

pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx IndexedHir<'tcx> {
assert_eq!(cnum, LOCAL_CRATE);

pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> &'tcx IndexedHir<'tcx> {
Copy link
Member

@varkor varkor May 16, 2021

Choose a reason for hiding this comment

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

Do we have to have a (): () parameter? Presumably this is a quirk of the query system?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The query system is designed to work with queries taking exactly two arguments: the TyCtxt and a key. I am not convinced that removing the extra () parameter is worth the added complexity in the query system. (I am not even sure this is possible without a sizeable modification to the query plumbing.)

@varkor
Copy link
Member

varkor commented May 16, 2021

I think it'd be better for someone more familiar with the query system to review here.

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned varkor May 16, 2021
@oli-obk
Copy link
Contributor

oli-obk commented May 16, 2021

(...) remnant of the multi-crate rustc idea

Sorry for the noise here but is this idea abandoned/discussed recently somewhere?

niko mentioned this in #71648 (comment)

considering the approval of niko and eddyb in #71648 let's go ahead with this idea

the changes themselves lgtm

@bors r+ rollup=never (bitrotty I presume)

@bors
Copy link
Collaborator

bors commented May 16, 2021

📌 Commit 1ebf6d1 has been approved by oli-obk

@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 16, 2021
@bors
Copy link
Collaborator

bors commented May 17, 2021

⌛ Testing commit 1ebf6d1 with merge 3396a38...

@bors
Copy link
Collaborator

bors commented May 17, 2021

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 3396a38 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 17, 2021
@bors bors merged commit 3396a38 into rust-lang:master May 17, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 17, 2021
@rust-highfive
Copy link
Contributor

📣 Toolstate changed by #85178!

Tested on commit 3396a38.
Direct link to PR: #85178

💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request May 17, 2021
Tested on commit rust-lang/rust@3396a38.
Direct link to PR: <rust-lang/rust#85178>

💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb).
@cjgillot cjgillot deleted the local-crate branch May 17, 2021 19:40
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 20, 2021
Remove CrateNum parameter for queries that only work on local crate

The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea.

Using `()` as query key in those cases avoids having to worry about the validity of the query key.
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request May 27, 2021
Remove CrateNum parameter for queries that only work on local crate

The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea.

Using `()` as query key in those cases avoids having to worry about the validity of the query key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

10 participants