We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a19b17 commit c0c569fCopy full SHA for c0c569f
compiler/rustc_middle/src/hir/map/mod.rs
@@ -598,7 +598,8 @@ impl<'hir> Map<'hir> {
598
/// in the HIR which is recorded by the map and is an item, either an item
599
/// in a module, trait, or impl.
600
pub fn get_parent_item(self, hir_id: HirId) -> OwnerId {
601
- if hir_id.local_id.index() != 0 {
+ if hir_id.local_id != ItemLocalId::ZERO {
602
+ // If this is a child of a HIR owner, return the owner.
603
hir_id.owner
604
} else if let Some((def_id, _node)) = self.parent_owner_iter(hir_id).next() {
605
def_id
0 commit comments