aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres/collector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 8bbf7ffa2..a1ea130e0 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -760,10 +760,11 @@ where
760 self.collect_derives(attrs, def); 760 self.collect_derives(attrs, def);
761 761
762 let name = def.name.clone(); 762 let name = def.name.clone();
763 let container = ContainerId::ModuleId(module);
763 let def: PerNs = match def.kind { 764 let def: PerNs = match def.kind {
764 raw::DefKind::Function(ast_id) => { 765 raw::DefKind::Function(ast_id) => {
765 let def = FunctionLoc { 766 let def = FunctionLoc {
766 container: ContainerId::ModuleId(module), 767 container: container.into(),
767 ast_id: AstId::new(self.file_id, ast_id), 768 ast_id: AstId::new(self.file_id, ast_id),
768 } 769 }
769 .intern(self.def_collector.db); 770 .intern(self.def_collector.db);
@@ -771,23 +772,23 @@ where
771 PerNs::values(def.into()) 772 PerNs::values(def.into())
772 } 773 }
773 raw::DefKind::Struct(ast_id) => { 774 raw::DefKind::Struct(ast_id) => {
774 let def = StructLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } 775 let def = StructLoc { container, ast_id: AstId::new(self.file_id, ast_id) }
775 .intern(self.def_collector.db); 776 .intern(self.def_collector.db);
776 PerNs::both(def.into(), def.into()) 777 PerNs::both(def.into(), def.into())
777 } 778 }
778 raw::DefKind::Union(ast_id) => { 779 raw::DefKind::Union(ast_id) => {
779 let def = UnionLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } 780 let def = UnionLoc { container, ast_id: AstId::new(self.file_id, ast_id) }
780 .intern(self.def_collector.db); 781 .intern(self.def_collector.db);
781 PerNs::both(def.into(), def.into()) 782 PerNs::both(def.into(), def.into())
782 } 783 }
783 raw::DefKind::Enum(ast_id) => { 784 raw::DefKind::Enum(ast_id) => {
784 let def = EnumLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } 785 let def = EnumLoc { container, ast_id: AstId::new(self.file_id, ast_id) }
785 .intern(self.def_collector.db); 786 .intern(self.def_collector.db);
786 PerNs::types(def.into()) 787 PerNs::types(def.into())
787 } 788 }
788 raw::DefKind::Const(ast_id) => { 789 raw::DefKind::Const(ast_id) => {
789 let def = ConstLoc { 790 let def = ConstLoc {
790 container: ContainerId::ModuleId(module), 791 container: container.into(),
791 ast_id: AstId::new(self.file_id, ast_id), 792 ast_id: AstId::new(self.file_id, ast_id),
792 } 793 }
793 .intern(self.def_collector.db); 794 .intern(self.def_collector.db);
@@ -795,20 +796,20 @@ where
795 PerNs::values(def.into()) 796 PerNs::values(def.into())
796 } 797 }
797 raw::DefKind::Static(ast_id) => { 798 raw::DefKind::Static(ast_id) => {
798 let def = StaticLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } 799 let def = StaticLoc { container, ast_id: AstId::new(self.file_id, ast_id) }
799 .intern(self.def_collector.db); 800 .intern(self.def_collector.db);
800 801
801 PerNs::values(def.into()) 802 PerNs::values(def.into())
802 } 803 }
803 raw::DefKind::Trait(ast_id) => { 804 raw::DefKind::Trait(ast_id) => {
804 let def = TraitLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } 805 let def = TraitLoc { container, ast_id: AstId::new(self.file_id, ast_id) }
805 .intern(self.def_collector.db); 806 .intern(self.def_collector.db);
806 807
807 PerNs::types(def.into()) 808 PerNs::types(def.into())
808 } 809 }
809 raw::DefKind::TypeAlias(ast_id) => { 810 raw::DefKind::TypeAlias(ast_id) => {
810 let def = TypeAliasLoc { 811 let def = TypeAliasLoc {
811 container: ContainerId::ModuleId(module), 812 container: container.into(),
812 ast_id: AstId::new(self.file_id, ast_id), 813 ast_id: AstId::new(self.file_id, ast_id),
813 } 814 }
814 .intern(self.def_collector.db); 815 .intern(self.def_collector.db);