1
Fork 0

hir: Add some FIXMEs for future work

This commit is contained in:
Vadim Petrochenkov 2024-01-31 21:55:10 +03:00
parent a61019b290
commit 3e8c8d8d34
4 changed files with 6 additions and 0 deletions

View file

@ -222,6 +222,9 @@ impl<'hir> Map<'hir> {
/// If calling repeatedly and iterating over parents, prefer [`Map::parent_iter`].
pub fn opt_parent_id(self, id: HirId) -> Option<HirId> {
if id.local_id == ItemLocalId::from_u32(0) {
// FIXME: This function never returns `None` right now, and the parent chain end is
// determined by checking for `parent(id) == id`. This function should return `None`
// for the crate root instead.
Some(self.tcx.hir_owner_parent(id.owner))
} else {
let owner = self.tcx.hir_owner_nodes(id.owner);