Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/find_path.rs')
| -rw-r--r-- | crates/hir-def/src/find_path.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/hir-def/src/find_path.rs b/crates/hir-def/src/find_path.rs index 67e43f15cd..3ff51b9845 100644 --- a/crates/hir-def/src/find_path.rs +++ b/crates/hir-def/src/find_path.rs @@ -2,7 +2,10 @@ use std::{cmp::Ordering, iter}; -use hir_expand::name::{known, AsName, Name}; +use hir_expand::{ + name::{known, AsName, Name}, + Lookup, +}; use rustc_hash::FxHashSet; use crate::{ @@ -139,9 +142,10 @@ fn find_path_inner(ctx: FindPathCtx<'_>, item: ItemInNs, from: ModuleId) -> Opti if let Some(ModuleDefId::EnumVariantId(variant)) = item.as_module_def_id() { // - if the item is an enum variant, refer to it via the enum - if let Some(mut path) = find_path_inner(ctx, ItemInNs::Types(variant.parent.into()), from) { - let data = ctx.db.enum_data(variant.parent); - path.push_segment(data.variants[variant.local_id].name.clone()); + if let Some(mut path) = + find_path_inner(ctx, ItemInNs::Types(variant.lookup(ctx.db).parent.into()), from) + { + path.push_segment(ctx.db.enum_variant_data(variant).name.clone()); return Some(path); } // If this doesn't work, it seems we have no way of referring to the |