-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
hir: replace "items" terminology with "nodes" where appropriate. #70092
Conversation
src/librustc/query/mod.rs
Outdated
@@ -70,19 +70,19 @@ rustc_queries! { | |||
eval_always | |||
} | |||
|
|||
// An HIR item with a `DefId` that can own other HIR items which do not themselves have | |||
// An HIR node with a `DefId` that can own other HIR nodes which do not themselves have |
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.
These comments turned out to be inaccurate since some nodes have both a DefId
and a HirId
without being a HIR owner themselves. Maybe fix them?
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.
These comments turned out to be inaccurate since some nodes have both a
DefId
and aHirId
without being a HIR owner themselves. Maybe fix them?
Right, currently only a subset of DefId
s are HIR owners. I'll take a second look at these comments to try and make that clear.
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.
Tried something, but whew that phrasing is hard to use.
I would be happier with hir::Owner
(or I guess hir::OwnerKind
) being a subset of Node
and explicitly listing all of the supported node types.
Then it sort of self-documents what kinds of nodes are owners.
And I could also use it to add a visit_owner
method to HIR visitors that would work with exhaustive matching.
But I didn't want to put any changes like that into this tiny PR.
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 think it's probably better to assume that the reader know what a HIR owner is here. I can barely make sense of the comments and I wrote the code =P
907fba3
to
3177889
Compare
This comment has been minimized.
This comment has been minimized.
3177889
to
262ee32
Compare
262ee32
to
41ecc0f
Compare
cc @petrochenkov (since you've reviewed my recent changes around HIR) |
The PR looks good to me excluding the comments on the queries. |
41ecc0f
to
be9679d
Compare
@bors r+ |
📌 Commit be9679d has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#67888 (Prefetch some queries used by the metadata encoder) - rust-lang#69934 (Update the mir inline costs) - rust-lang#69965 (Refactorings to get rid of rustc_codegen_utils) - rust-lang#70054 (Build dist-android with --enable-profiler) - rust-lang#70089 (rustc_infer: remove InferCtxt::closure_sig as the FnSig is always shallowly known.) - rust-lang#70092 (hir: replace "items" terminology with "nodes" where appropriate.) - rust-lang#70138 (do not 'return' in 'throw_' macros) - rust-lang#70151 (Update stdarch submodule) Failed merges: - rust-lang#70074 (Expand: nix all fatal errors) r? @ghost
The newly added
HirOwnerItems
confused me before I realized that "items" there actually referred to HIR nodes, nothir:Item
or "item-like" (which we should IMO replace with "owner").I suspect the naming had something to do with
ItemLocalId
's use of "item".That is,
ItemLocalId
could be interpreted to mean one of two things:IntraItemNodeId
i.e.IntraOwnerNodeId
IntraOwnerItemId
HirOwnerItems
would seem to implyr? @Zoxc cc @michaelwoerister @nikomatsakis