Skip to content

Add descriptions for all queries #72823

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
Jun 1, 2020

Conversation

matthewjasper
Copy link
Contributor

This also removes the default description for queries with DefId keys and makes the macro validate that a description is provided.

cc #72730
r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 31, 2020
@@ -91,6 +91,7 @@ rustc_queries! {

/// Records the type of every item.
query type_of(key: DefId) -> Ty<'tcx> {
desc { |tcx| "getting type of `{}`", tcx.def_path_str(key) }
Copy link
Member

Choose a reason for hiding this comment

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

Not sure "getting" is the best wording (but also idk what previous discussion has happened on the topic).
I'd probably prefer "computing" instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed a few queries which are essentially caches in front of the HIR/crate metadata to "looking up", as "computing" didn't feel right.

@@ -395,8 +436,10 @@ rustc_queries! {
desc { |tcx| "processing `{}`", tcx.def_path_str(key.to_def_id()) }
Copy link
Member

Choose a reason for hiding this comment

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

This makes me realize there are pre-existing instances of processing, maybe open an issue about getting rid of that wording entirely, if you don't plan to handle it in this PR.

@@ -482,7 +527,9 @@ rustc_queries! {
}

TypeChecking {
query has_typeck_tables(_: DefId) -> bool {}
query has_typeck_tables(def_id: DefId) -> bool {
desc { |tcx| "checking whether `{}` has a body", tcx.def_path_str(def_id) }
Copy link
Member

@eddyb eddyb May 31, 2020

Choose a reason for hiding this comment

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

Is it limited to bodies? If so, it should probably be renamed (open an issue I guess). Otherwise, it should say "can be type-checked" or "has type-checking results".

Oh this reminds me that I've wanted TypeckTables to become TypeckResults (or something) for a while now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

has_typeck_tables is essentially primary_body_of(tcx, id).is_some(), so, yes, this is limited to crate-local items which have bodies.

Comment on lines 703 to 704
query fn_arg_names(def_id: DefId) -> &'tcx [Symbol] {
desc { |tcx| "getting function parameter names for `{}`", tcx.def_path_str(def_id) }
Copy link
Member

Choose a reason for hiding this comment

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

Heh the query could probably use a rename (arg -> param), cc @varkor

Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

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

r=me with comments addressed, especially the "getting" one (fwiw I don't mind if you want to stick with it for now, or if others prefer it over alternatives)

@matthewjasper
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Collaborator

bors commented May 31, 2020

📌 Commit 8894bd2 has been approved by eddyb

@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 31, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 1, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#72776 (fulfill: try using SmallVec or Box for stalled_on)
 - rust-lang#72818 (Clean up E0622 explanation)
 - rust-lang#72823 (Add descriptions for all queries)
 - rust-lang#72832 (RELEASES.md: Expand `cargo tree` note to mention `cargo tree -d`)
 - rust-lang#72834 (Rephrase term 'non-pointer type')

Failed merges:

r? @ghost
@bors bors merged commit cf46836 into rust-lang:master Jun 1, 2020
@matthewjasper matthewjasper deleted the describe-queries branch June 1, 2020 10:10
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants