-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Conversation
src/librustc_middle/query/mod.rs
Outdated
@@ -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) } |
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.
Not sure "getting" is the best wording (but also idk what previous discussion has happened on the topic).
I'd probably prefer "computing" instead.
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.
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()) } |
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.
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) } |
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.
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.
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.
has_typeck_tables
is essentially primary_body_of(tcx, id).is_some()
, so, yes, this is limited to crate-local items which have bodies.
src/librustc_middle/query/mod.rs
Outdated
query fn_arg_names(def_id: DefId) -> &'tcx [Symbol] { | ||
desc { |tcx| "getting function parameter names for `{}`", tcx.def_path_str(def_id) } |
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.
Heh the query could probably use a rename (arg
-> param
), cc @varkor
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.
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)
6f612f8
to
8894bd2
Compare
@bors r=eddyb |
📌 Commit 8894bd2 has been approved by |
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
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