mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Update compiler/rustc_middle/src/hir/map/mod.rs
Co-authored-by: Michael Goulet <michael@errs.io>
This commit is contained in:
parent
7a19b17084
commit
c0c569f99d
@ -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 the HIR which is recorded by the map and is an item, either an item
|
||||||
/// in a module, trait, or impl.
|
/// in a module, trait, or impl.
|
||||||
pub fn get_parent_item(self, hir_id: HirId) -> OwnerId {
|
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
|
hir_id.owner
|
||||||
} else if let Some((def_id, _node)) = self.parent_owner_iter(hir_id).next() {
|
} else if let Some((def_id, _node)) = self.parent_owner_iter(hir_id).next() {
|
||||||
def_id
|
def_id
|
||||||
|
Loading…
Reference in New Issue
Block a user