Pre-compute LocalDefId <-> HirId mappings and remove NodeId <-> HirId conversion APIs#73291
Conversation
|
Next step is probably to move node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>,
def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,mappings from |
|
What is the end goal here, removing any mentions of
struct Definitions {
// Both before and after (or filled before, used after)
table: DefPathTable,
parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>,
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,
// Before
def_id_to_span: IndexVec<LocalDefId, Span>,
node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>,
def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,
next_disambiguator: FxHashMap<(LocalDefId, DefPathData), u32>,
invocation_parents: FxHashMap<ExpnId, LocalDefId>,
placeholder_field_indices: FxHashMap<ast::NodeId, usize>,
// ???
node_id_to_hir_id: IndexVec<ast::NodeId, Option<hir::HirId>>,
hir_id_to_node_id: FxHashMap<hir::HirId, ast::NodeId>,
}Having the "before" fields in the |
|
The "after" fields could actually go into |
|
My idea was to move everything So to summarize, using this PR as base of discussion,
TL;DR: "before" fields in |
Sounds like a plan! |
bf059a3 to
864872b
Compare
|
ID memo:
cc @mark-i-m this can probably be added to the dev guide |
Use `LocalDefId` for import IDs in trait map cc rust-lang#73291 (comment)
Use `LocalDefId` for import IDs in trait map cc rust-lang#73291 (comment)
Use `LocalDefId` for import IDs in trait map cc rust-lang#73291 (comment)
Use `LocalDefId` for import IDs in trait map cc rust-lang#73291 (comment)
|
☔ The latest upstream changes (presumably #73511) made this pull request unmergeable. Please resolve the merge conflicts. |
|
#73357 has landed. |
864872b to
b4fc8bd
Compare
|
@petrochenkov rebased and fixed the conflicts 👍 |
b4fc8bd to
58d8374
Compare
This comment has been minimized.
This comment has been minimized.
58d8374 to
13104ef
Compare
|
@bors r+ |
|
📌 Commit 13104ef has been approved by |
…=petrochenkov Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs cc rust-lang#50928 I don't know who is exactly the best person to review this. r? @petrochenkov
…arth Rollup of 9 pull requests Successful merges: - rust-lang#72456 (Try to suggest dereferences on trait selection failed) - rust-lang#72788 (Projection bound validation) - rust-lang#72790 (core/time: Add Duration methods for zero) - rust-lang#73227 (Allow multiple `asm!` options groups and report an error on duplicate options) - rust-lang#73287 (lint: normalize projections using opaque types) - rust-lang#73291 (Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs) - rust-lang#73378 (Remove use of specialization from librustc_arena) - rust-lang#73411 (Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d 2020-06-15)) - rust-lang#73443 (ci: allow gating GHA on everything but macOS) Failed merges: r? @ghost
… r=petrochenkov Move remaining `NodeId` APIs from `Definitions` to `Resolver` Implements rust-lang#73291 (comment) TL;DR: it moves all fields that are only needed during name resolution passes into the `Resolver` and keep the rest in `Definitions`. This effectively enforces that all references to `NodeId`s are gone once HIR lowering is completed. After this, the only remaining work for rust-lang#50928 should be to adjust the dev guide. r? @petrochenkov
… r=petrochenkov Move remaining `NodeId` APIs from `Definitions` to `Resolver` Implements rust-lang#73291 (comment) TL;DR: it moves all fields that are only needed during name resolution passes into the `Resolver` and keep the rest in `Definitions`. This effectively enforces that all references to `NodeId`s are gone once HIR lowering is completed. After this, the only remaining work for rust-lang#50928 should be to adjust the dev guide. r? @petrochenkov
cc #50928
I don't know who is exactly the best person to review this.
r? @petrochenkov