-
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
Remove all uses of NodeId
in ResolverOutputs
#72402
Conversation
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.
cc @ljedrz
Left a nit. I'll approve once it is fixed and CI is green. Thanks @marmeladema!
pub extern_crate_map: FxHashMap<DefId, CrateNum>, | ||
pub trait_map: FxHashMap<hir::HirId, Vec<hir::TraitCandidate<hir::HirId>>>, | ||
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>, | ||
pub maybe_unused_extern_crates: Vec<(DefId, Span)>, | ||
pub export_map: ExportMap<hir::HirId>, | ||
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>, |
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.
It does seem like all of these could plausibly be DefId
. Did you find something during your experiments that wasn't a definition? If not, we should open a cleanup issue once this gets merged.
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 only tried for trait_map
but yes, for this field, there is no def id, only hir 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.
@petrochenkov I see you've assigned yourself. Any recommendations here? Is there a reason that trait_map
and export_map
cannot use DefId
s?
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.
Also because the global context uses HirId
, using DefId
here would mean another map clone/conversion in librustc_middle
.
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.
The zoo of DefId
s, LocalDefId
s and HirId
s here is a bit surprising (all of these could be LocalDefId
s (or HirId
s)), but it looks like the choices are made to minimize conversions at use sites.
I guess the right thing to do here would be changing DefId
s into LocalDefId
s in GlobalCtxt
which is the end destination of these tables.
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 can definitely take a look at that in a follow up PR!
…tead of `NodeId`
bc1f1f1
to
f31e076
Compare
Rebased and fixed comments |
Thanks @marmeladema! It's possible that someone with more knowledge of AST -> HIR lowering (@petrochenkov?) could find an elegant solution to #72402 (comment). However, because this may unlock #50928 (comment), I'm happy to approve it in its present state. @bors r+ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
📌 Commit f31e076 has been approved by |
…, r=ecstatic-morse Remove all uses of `NodeId` in `ResolverOutputs` cc rust-lang#50928 r? @ecstatic-morse
…, r=ecstatic-morse Remove all uses of `NodeId` in `ResolverOutputs` cc rust-lang#50928 r? @ecstatic-morse
…, r=ecstatic-morse Remove all uses of `NodeId` in `ResolverOutputs` cc rust-lang#50928 r? @ecstatic-morse
Rollup of 5 pull requests Successful merges: - rust-lang#72402 (Remove all uses of `NodeId` in `ResolverOutputs`) - rust-lang#72527 (bootstrap: propagate test-args to miri and clippy test suites) - rust-lang#72530 (Clean up E0602 explanation) - rust-lang#72532 (Use `dyn` trait syntax in more comments and docs) - rust-lang#72535 (Use sort_unstable_by in its own docs) Failed merges: r? @ghost
…, r=petrochenkov Cleanup `Resolver::<clone|into>_outputs` methods Follow-up cleanup work of rust-lang#72402 First commit has been split out from rust-lang#72552 r? @ecstatic-morse
cc #50928
r? @ecstatic-morse