From 3ab1519cb27b927074ed7fbbb18a856e6e7fabb8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 23:14:13 +0300 Subject: Change ids strategy this is a part of larghish hir refactoring which aims to * replace per-source-root module trees with per crate trees * switch from a monotyped DedId to type-specific ids --- crates/ra_hir/src/code_model_impl/krate.rs | 24 +--- crates/ra_hir/src/code_model_impl/module.rs | 180 ++++++++++++---------------- 2 files changed, 79 insertions(+), 125 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs index 8c6e34873..cdd30b402 100644 --- a/crates/ra_hir/src/code_model_impl/krate.rs +++ b/crates/ra_hir/src/code_model_impl/krate.rs @@ -1,7 +1,7 @@ use ra_db::CrateId; use crate::{ - HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId, + Crate, CrateDependency, AsName, Module, db::HirDatabase, }; @@ -21,27 +21,13 @@ impl Crate { .collect() } pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option { - let crate_graph = db.crate_graph(); - let file_id = crate_graph.crate_root(self.crate_id); - let source_root_id = db.file_source_root(file_id); - let file_id = HirFileId::from(file_id); - let module_tree = db.module_tree(source_root_id); - // FIXME: teach module tree about crate roots instead of guessing - let source = SourceItemId { - file_id, - item_id: None, - }; - let module_id = module_tree.find_module_by_source(source)?; + let module_tree = db.module_tree(self.crate_id); + let module_id = module_tree.modules().next()?; - let def_loc = DefLoc { - kind: DefKind::Module, - source_root_id, + let module = Module { + krate: self.crate_id, module_id, - source_item_id: module_id.source(&module_tree), }; - let def_id = def_loc.id(db); - - let module = Module::new(def_id); Some(module) } } diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index d94079f11..5d00e905b 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -1,52 +1,33 @@ -use ra_db::{SourceRootId, FileId}; -use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc}; +use ra_db::FileId; +use ra_syntax::{ast, SyntaxNode, TreeArc}; use crate::{ - Module, ModuleSource, Problem, - Crate, DefId, DefLoc, DefKind, Name, Path, PathKind, PerNs, Def, + Module, ModuleSource, Problem, ModuleDef, + Crate, Name, Path, PathKind, PerNs, Def, module_tree::ModuleId, nameres::{ModuleScope, lower::ImportId}, db::HirDatabase, }; impl Module { - pub(crate) fn new(def_id: DefId) -> Self { - crate::code_model_api::Module { def_id } - } - - pub(crate) fn from_module_id( - db: &impl HirDatabase, - source_root_id: SourceRootId, - module_id: ModuleId, - ) -> Self { - let module_tree = db.module_tree(source_root_id); - let def_loc = DefLoc { - kind: DefKind::Module, - source_root_id, + fn with_module_id(&self, module_id: ModuleId) -> Module { + Module { module_id, - source_item_id: module_id.source(&module_tree), - }; - let def_id = def_loc.id(db); - Module::new(def_id) + krate: self.krate, + } } pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Option { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let link = loc.module_id.parent_link(&module_tree)?; + let module_tree = db.module_tree(self.krate); + let link = self.module_id.parent_link(&module_tree)?; Some(link.name(&module_tree).clone()) } pub(crate) fn definition_source_impl(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) { - let loc = self.def_id.loc(db); - let file_id = loc.source_item_id.file_id.as_original_file(); - let syntax_node = db.file_item(loc.source_item_id); - let module_source = if let Some(source_file) = ast::SourceFile::cast(&syntax_node) { - ModuleSource::SourceFile(source_file.to_owned()) - } else { - let module = ast::Module::cast(&syntax_node).unwrap(); - ModuleSource::Module(module.to_owned()) - }; + let module_tree = db.module_tree(self.krate); + let source = self.module_id.source(&module_tree); + let module_source = ModuleSource::from_source_item_id(db, source); + let file_id = source.file_id.as_original_file(); (file_id, module_source) } @@ -54,9 +35,8 @@ impl Module { &self, db: &impl HirDatabase, ) -> Option<(FileId, TreeArc)> { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let link = loc.module_id.parent_link(&module_tree)?; + let module_tree = db.module_tree(self.krate); + let link = self.module_id.parent_link(&module_tree)?; let file_id = link .owner(&module_tree) .source(&module_tree) @@ -71,85 +51,67 @@ impl Module { db: &impl HirDatabase, import: ImportId, ) -> TreeArc { - let loc = self.def_id.loc(db); - let source_map = db.lower_module_source_map(loc.source_root_id, loc.module_id); + let source_map = db.lower_module_source_map(self.clone()); let (_, source) = self.definition_source(db); source_map.get(&source, import) } - pub(crate) fn krate_impl(&self, db: &impl HirDatabase) -> Option { - let root = self.crate_root(db); - let loc = root.def_id.loc(db); - let file_id = loc.source_item_id.file_id.as_original_file(); - - let crate_graph = db.crate_graph(); - let crate_id = crate_graph.crate_id_for_crate_root(file_id)?; - Some(Crate::new(crate_id)) + pub(crate) fn krate_impl(&self, _db: &impl HirDatabase) -> Option { + Some(Crate::new(self.krate)) } pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Module { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let module_id = loc.module_id.crate_root(&module_tree); - Module::from_module_id(db, loc.source_root_id, module_id) + let module_tree = db.module_tree(self.krate); + let module_id = self.module_id.crate_root(&module_tree); + self.with_module_id(module_id) } /// Finds a child module with the specified name. pub(crate) fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let child_id = loc.module_id.child(&module_tree, name)?; - Some(Module::from_module_id(db, loc.source_root_id, child_id)) + let module_tree = db.module_tree(self.krate); + let child_id = self.module_id.child(&module_tree, name)?; + Some(self.with_module_id(child_id)) } /// Iterates over all child modules. pub(crate) fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator { - // FIXME this should be implementable without collecting into a vec, but - // it's kind of hard since the iterator needs to keep a reference to the - // module tree. - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let children = loc + let module_tree = db.module_tree(self.krate); + let children = self .module_id .children(&module_tree) - .map(|(_, module_id)| Module::from_module_id(db, loc.source_root_id, module_id)) + .map(|(_, module_id)| self.with_module_id(module_id)) .collect::>(); children.into_iter() } pub(crate) fn parent_impl(&self, db: &impl HirDatabase) -> Option { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - let parent_id = loc.module_id.parent(&module_tree)?; - Some(Module::from_module_id(db, loc.source_root_id, parent_id)) + let module_tree = db.module_tree(self.krate); + let parent_id = self.module_id.parent(&module_tree)?; + Some(self.with_module_id(parent_id)) } /// Returns a `ModuleScope`: a set of items, visible in this module. pub(crate) fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope { - let loc = self.def_id.loc(db); - let item_map = db.item_map(loc.source_root_id); - item_map.per_module[&loc.module_id].clone() + let item_map = db.item_map(self.krate); + item_map.per_module[&self.module_id].clone() } - pub(crate) fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs { - let mut curr_per_ns = PerNs::types( - match path.kind { - PathKind::Crate => self.crate_root(db), - PathKind::Self_ | PathKind::Plain => self.clone(), - PathKind::Super => { - if let Some(p) = self.parent(db) { - p - } else { - return PerNs::none(); - } - } - PathKind::Abs => { - // TODO: absolute use is not supported + pub(crate) fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs { + let mut curr_per_ns: PerNs = PerNs::types(match path.kind { + PathKind::Crate => self.crate_root(db).into(), + PathKind::Self_ | PathKind::Plain => self.clone().into(), + PathKind::Super => { + if let Some(p) = self.parent(db) { + p.into() + } else { return PerNs::none(); } } - .def_id, - ); + PathKind::Abs => { + // TODO: absolute use is not supported + return PerNs::none(); + } + }); for segment in path.segments.iter() { let curr = match curr_per_ns.as_ref().take_types() { @@ -164,32 +126,39 @@ impl Module { } }; // resolve segment in curr - curr_per_ns = match curr.resolve(db) { - Def::Module(m) => { + + curr_per_ns = match curr { + ModuleDef::Module(m) => { let scope = m.scope(db); match scope.get(&segment.name) { - Some(r) => r.def_id, + Some(r) => r.def_id.clone(), None => PerNs::none(), } } - Def::Enum(e) => { - // enum variant - let matching_variant = e - .variants(db) - .into_iter() - .find(|(n, _variant)| n == &segment.name); - - match matching_variant { - Some((_n, variant)) => PerNs::both(variant.def_id(), e.def_id()), - None => PerNs::none(), + ModuleDef::Def(def) => { + match def.resolve(db) { + Def::Enum(e) => { + // enum variant + let matching_variant = e + .variants(db) + .into_iter() + .find(|(n, _variant)| n == &segment.name); + + match matching_variant { + Some((_n, variant)) => { + PerNs::both(variant.def_id().into(), e.def_id().into()) + } + None => PerNs::none(), + } + } + _ => { + // could be an inherent method call in UFCS form + // (`Struct::method`), or some other kind of associated + // item... Which we currently don't handle (TODO) + PerNs::none() + } } } - _ => { - // could be an inherent method call in UFCS form - // (`Struct::method`), or some other kind of associated - // item... Which we currently don't handle (TODO) - PerNs::none() - } }; } curr_per_ns @@ -199,8 +168,7 @@ impl Module { &self, db: &impl HirDatabase, ) -> Vec<(TreeArc, Problem)> { - let loc = self.def_id.loc(db); - let module_tree = db.module_tree(loc.source_root_id); - loc.module_id.problems(&module_tree, db) + let module_tree = db.module_tree(self.krate); + self.module_id.problems(&module_tree, db) } } -- cgit v1.2.3 From ec7ed054e06cb2e23fd3911932766b32014c8fa1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 15:28:50 +0300 Subject: Functions use new id scheme --- crates/ra_hir/src/code_model_impl/function.rs | 29 +++++++++++++++++---------- crates/ra_hir/src/code_model_impl/module.rs | 1 + 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index c68c6bfbf..d8dafb10e 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -2,41 +2,48 @@ mod scope; use std::sync::Arc; -use ra_syntax::{TreeArc, ast::{self, NameOwner}}; +use ra_syntax::ast::{self, NameOwner}; use crate::{ - DefId, HirDatabase, Name, AsName, Function, FnSignature, Module, + HirDatabase, Name, AsName, Function, FnSignature, Module, HirFileId, type_ref::{TypeRef, Mutability}, expr::Body, impl_block::ImplBlock, - code_model_impl::def_id_to_ast, + ids::FunctionLoc, }; pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; impl Function { - pub(crate) fn new(def_id: DefId) -> Function { - Function { def_id } + pub(crate) fn from_ast( + db: &impl HirDatabase, + module: Module, + file_id: HirFileId, + ast: &ast::FnDef, + ) -> Function { + let loc: FunctionLoc = FunctionLoc::from_ast(db, module, file_id, ast); + let id = loc.id(db); + Function { id } } pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc { - db.body_hir(self.def_id) + db.body_hir(*self) } pub(crate) fn module(&self, db: &impl HirDatabase) -> Module { - self.def_id.module(db) + self.id.loc(db).module } /// The containing impl block, if this is a method. pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Option { - self.def_id.impl_block(db) + let module_impls = db.impls_in_module(self.module(db)); + ImplBlock::containing(module_impls, (*self).into()) } } impl FnSignature { - pub(crate) fn fn_signature_query(db: &impl HirDatabase, def_id: DefId) -> Arc { - // FIXME: we're using def_id_to_ast here to avoid returning Cancelable... this is a bit hacky - let node: TreeArc = def_id_to_ast(db, def_id).1; + pub(crate) fn fn_signature_query(db: &impl HirDatabase, func: Function) -> Arc { + let (_, node) = func.source(db); let name = node .name() .map(|n| n.as_name()) diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 5d00e905b..b2828c7be 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -135,6 +135,7 @@ impl Module { None => PerNs::none(), } } + ModuleDef::Function(_) => PerNs::none(), ModuleDef::Def(def) => { match def.resolve(db) { Def::Enum(e) => { -- cgit v1.2.3 From 60a607d33f1c50acd0a4218da32abe35b2941e38 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 17:54:18 +0300 Subject: new struct id --- crates/ra_hir/src/code_model_impl/module.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index b2828c7be..42f10e941 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -135,7 +135,7 @@ impl Module { None => PerNs::none(), } } - ModuleDef::Function(_) => PerNs::none(), + ModuleDef::Function(_) | ModuleDef::Struct(_) => PerNs::none(), ModuleDef::Def(def) => { match def.resolve(db) { Def::Enum(e) => { -- cgit v1.2.3 From 566c8e321e89e5ff8996daa615cc47aea0012881 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 18:56:38 +0300 Subject: migrate enums to new id --- crates/ra_hir/src/code_model_impl/module.rs | 42 +++++++++++++---------------- 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 42f10e941..4ea649770 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -3,7 +3,7 @@ use ra_syntax::{ast, SyntaxNode, TreeArc}; use crate::{ Module, ModuleSource, Problem, ModuleDef, - Crate, Name, Path, PathKind, PerNs, Def, + Crate, Name, Path, PathKind, PerNs, module_tree::ModuleId, nameres::{ModuleScope, lower::ImportId}, db::HirDatabase, @@ -135,31 +135,25 @@ impl Module { None => PerNs::none(), } } - ModuleDef::Function(_) | ModuleDef::Struct(_) => PerNs::none(), - ModuleDef::Def(def) => { - match def.resolve(db) { - Def::Enum(e) => { - // enum variant - let matching_variant = e - .variants(db) - .into_iter() - .find(|(n, _variant)| n == &segment.name); - - match matching_variant { - Some((_n, variant)) => { - PerNs::both(variant.def_id().into(), e.def_id().into()) - } - None => PerNs::none(), - } - } - _ => { - // could be an inherent method call in UFCS form - // (`Struct::method`), or some other kind of associated - // item... Which we currently don't handle (TODO) - PerNs::none() - } + ModuleDef::Enum(e) => { + // enum variant + let matching_variant = e + .variants(db) + .into_iter() + .find(|(n, _variant)| n == &segment.name); + + match matching_variant { + Some((_n, variant)) => PerNs::both(variant.def_id().into(), (*e).into()), + None => PerNs::none(), } } + ModuleDef::Function(_) | ModuleDef::Struct(_) => { + // could be an inherent method call in UFCS form + // (`Struct::method`), or some other kind of associated + // item... Which we currently don't handle (TODO) + PerNs::none() + } + ModuleDef::Def(_) => PerNs::none(), }; } curr_per_ns -- cgit v1.2.3 From 11dda8a0fb905a1b41a64001d564632eb062b9aa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 19:29:44 +0300 Subject: remove useless aliases --- crates/ra_hir/src/code_model_impl/function.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index d8dafb10e..8a2ab5714 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -9,7 +9,7 @@ use crate::{ type_ref::{TypeRef, Mutability}, expr::Body, impl_block::ImplBlock, - ids::FunctionLoc, + ids::ItemLoc, }; pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; @@ -21,8 +21,8 @@ impl Function { file_id: HirFileId, ast: &ast::FnDef, ) -> Function { - let loc: FunctionLoc = FunctionLoc::from_ast(db, module, file_id, ast); - let id = loc.id(db); + let loc = ItemLoc::from_ast(db, module, file_id, ast); + let id = db.as_ref().fns.loc2id(&loc); Function { id } } -- cgit v1.2.3 From 4c514a3e02b019cdd3a17c9bcd78d93c210ab267 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 23:32:41 +0300 Subject: move enum variant to the new API --- crates/ra_hir/src/code_model_impl/module.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 4ea649770..aa5e5d689 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -143,11 +143,11 @@ impl Module { .find(|(n, _variant)| n == &segment.name); match matching_variant { - Some((_n, variant)) => PerNs::both(variant.def_id().into(), (*e).into()), + Some((_n, variant)) => PerNs::both(variant.into(), (*e).into()), None => PerNs::none(), } } - ModuleDef::Function(_) | ModuleDef::Struct(_) => { + ModuleDef::Function(_) | ModuleDef::Struct(_) | ModuleDef::EnumVariant(_) => { // could be an inherent method call in UFCS form // (`Struct::method`), or some other kind of associated // item... Which we currently don't handle (TODO) -- cgit v1.2.3 From 90215eb5a026d446ae7e5d4e62c43d6d8c82edf1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 00:02:18 +0300 Subject: generalize boilerplate --- crates/ra_hir/src/code_model_impl/function.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index 8a2ab5714..6ce5c77b1 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -30,10 +30,6 @@ impl Function { db.body_hir(*self) } - pub(crate) fn module(&self, db: &impl HirDatabase) -> Module { - self.id.loc(db).module - } - /// The containing impl block, if this is a method. pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Option { let module_impls = db.impls_in_module(self.module(db)); -- cgit v1.2.3 From f588535273db261c32e23c1b0221d03ad82cd94d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 00:26:54 +0300 Subject: remove boilerplate --- crates/ra_hir/src/code_model_impl/function.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index 6ce5c77b1..e0dd4d629 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -5,27 +5,15 @@ use std::sync::Arc; use ra_syntax::ast::{self, NameOwner}; use crate::{ - HirDatabase, Name, AsName, Function, FnSignature, Module, HirFileId, + HirDatabase, Name, AsName, Function, FnSignature, type_ref::{TypeRef, Mutability}, expr::Body, impl_block::ImplBlock, - ids::ItemLoc, }; pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; impl Function { - pub(crate) fn from_ast( - db: &impl HirDatabase, - module: Module, - file_id: HirFileId, - ast: &ast::FnDef, - ) -> Function { - let loc = ItemLoc::from_ast(db, module, file_id, ast); - let id = db.as_ref().fns.loc2id(&loc); - Function { id } - } - pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc { db.body_hir(*self) } -- cgit v1.2.3 From 1db2cbcb8bd61b4f19f61cc6319343e5ad894515 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 00:50:08 +0300 Subject: move consts&statics to new id --- crates/ra_hir/src/code_model_impl/module.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index aa5e5d689..1518825c7 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -147,7 +147,11 @@ impl Module { None => PerNs::none(), } } - ModuleDef::Function(_) | ModuleDef::Struct(_) | ModuleDef::EnumVariant(_) => { + ModuleDef::Function(_) + | ModuleDef::Struct(_) + | ModuleDef::Const(_) + | ModuleDef::Static(_) + | ModuleDef::EnumVariant(_) => { // could be an inherent method call in UFCS form // (`Struct::method`), or some other kind of associated // item... Which we currently don't handle (TODO) -- cgit v1.2.3 From 0f2f3a21e7e624f920d182869896347af309e909 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 01:31:32 +0300 Subject: Migrate trait & type to new ids --- crates/ra_hir/src/code_model_impl/module.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 1518825c7..6419d3934 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -147,17 +147,12 @@ impl Module { None => PerNs::none(), } } - ModuleDef::Function(_) - | ModuleDef::Struct(_) - | ModuleDef::Const(_) - | ModuleDef::Static(_) - | ModuleDef::EnumVariant(_) => { + _ => { // could be an inherent method call in UFCS form // (`Struct::method`), or some other kind of associated // item... Which we currently don't handle (TODO) PerNs::none() } - ModuleDef::Def(_) => PerNs::none(), }; } curr_per_ns -- cgit v1.2.3