From 111891dc2dc1d2c7ea87144e8e3ddefe23fc7b6d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Nov 2019 18:00:01 +0300 Subject: Move constants to new ID This allows us to get rid of trait item index --- crates/ra_hir_def/src/impls.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def/src/impls.rs') diff --git a/crates/ra_hir_def/src/impls.rs b/crates/ra_hir_def/src/impls.rs index 574086ac7..750a869f2 100644 --- a/crates/ra_hir_def/src/impls.rs +++ b/crates/ra_hir_def/src/impls.rs @@ -9,8 +9,8 @@ use hir_expand::AstId; use ra_syntax::ast; use crate::{ - db::DefDatabase2, type_ref::TypeRef, AssocItemId, AstItemDef, ConstId, ContainerId, - FunctionLoc, ImplId, Intern, LocationCtx, TypeAliasLoc, + db::DefDatabase2, type_ref::TypeRef, AssocItemId, AstItemDef, ConstLoc, ContainerId, + FunctionLoc, ImplId, Intern, TypeAliasLoc, }; #[derive(Debug, Clone, PartialEq, Eq)] @@ -31,7 +31,6 @@ impl ImplData { let negative = src.value.is_negative(); let items = if let Some(item_list) = src.value.item_list() { - let ctx = LocationCtx::new(db, id.module(db), src.file_id); item_list .impl_items() .map(|item_node| match item_node { @@ -44,7 +43,12 @@ impl ImplData { def.into() } ast::ImplItem::ConstDef(it) => { - ConstId::from_ast_id(ctx, items.ast_id(&it)).into() + let def = ConstLoc { + container: ContainerId::ImplId(id), + ast_id: AstId::new(src.file_id, items.ast_id(&it)), + } + .intern(db); + def.into() } ast::ImplItem::TypeAliasDef(it) => { let def = TypeAliasLoc { -- cgit v1.2.3