Skip to content

Commit

Permalink
Update compiler/rustc_middle/src/hir/map/mod.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Goulet <michael@errs.io>
  • Loading branch information
m-ou-se and compiler-errors authored Sep 23, 2024
1 parent 7a19b17 commit c0c569f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ impl<'hir> Map<'hir> {
/// in the HIR which is recorded by the map and is an item, either an item
/// in a module, trait, or impl.
pub fn get_parent_item(self, hir_id: HirId) -> OwnerId {
if hir_id.local_id.index() != 0 {
if hir_id.local_id != ItemLocalId::ZERO {
// If this is a child of a HIR owner, return the owner.
hir_id.owner
} else if let Some((def_id, _node)) = self.parent_owner_iter(hir_id).next() {
def_id
Expand Down

0 comments on commit c0c569f

Please sign in to comment.