3

rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables by petrochen...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/87568
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Collaborator

rust-highfive commented 18 days ago

Some changes occurred in intra-doc-links.

cc @jyn514

break;

}

module_id = self.tcx.hir().get_parent_node(module_id);

module_def_id =

ty::DefIdTree::parent(self.tcx, module_def_id.to_def_id()).unwrap().expect_local();

petrochenkov 18 days ago

Author

Contributor

The logic in this function was slightly changed to walk DefId parents instead of HirId parents, but the end result should be the same, I think.

cjgillot 16 days ago

Contributor

IIUC, this loop is only accessed when macro_module_def_id point to a module that can be named from the outside. As a consequence, all its parents are modules. This is relied upon by update_macro_reachable. All modules are HIR owners, so walking parents by def_key or through HIR is equivalent.
Do you agree with the explanation? Should there be a comment?
Can the loop be simplified using tcx.hir().parent_owner_iter()?

petrochenkov 15 days ago

Author

Contributor

Added a comment.
parent_owner_iter doesn't seem to make things simpler because it requires converting to HirIds and back.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK