aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs11
-rw-r--r--crates/ra_hir/src/docs.rs2
-rw-r--r--crates/ra_hir/src/generics.rs2
-rw-r--r--crates/ra_hir/src/type_alias.rs2
4 files changed, 12 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index a8a0875e0..20a8d7d80 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -932,12 +932,19 @@ pub struct TypeAlias {
932 pub(crate) id: TypeAliasId, 932 pub(crate) id: TypeAliasId,
933} 933}
934 934
935impl HasSource for TypeAlias {
936 type Ast = TreeArc<ast::TypeAliasDef>;
937 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::TypeAliasDef>> {
938 self.id.source(db).into()
939 }
940}
941
935impl TypeAlias { 942impl TypeAlias {
936 pub fn source( 943 pub fn source(
937 self, 944 self,
938 db: &(impl DefDatabase + AstDatabase), 945 db: &(impl DefDatabase + AstDatabase),
939 ) -> (HirFileId, TreeArc<ast::TypeAliasDef>) { 946 ) -> Source<TreeArc<ast::TypeAliasDef>> {
940 self.id.source(db) 947 self.id.source(db).into()
941 } 948 }
942 949
943 pub fn module(self, db: &impl DefDatabase) -> Module { 950 pub fn module(self, db: &impl DefDatabase) -> Module {
diff --git a/crates/ra_hir/src/docs.rs b/crates/ra_hir/src/docs.rs
index 86ca981f4..1c6b4f205 100644
--- a/crates/ra_hir/src/docs.rs
+++ b/crates/ra_hir/src/docs.rs
@@ -84,7 +84,7 @@ pub(crate) fn documentation_query(
84 DocDef::Function(it) => docs_from_ast(&*it.source(db).ast), 84 DocDef::Function(it) => docs_from_ast(&*it.source(db).ast),
85 DocDef::Union(it) => docs_from_ast(&*it.source(db).1), 85 DocDef::Union(it) => docs_from_ast(&*it.source(db).1),
86 DocDef::Trait(it) => docs_from_ast(&*it.source(db).1), 86 DocDef::Trait(it) => docs_from_ast(&*it.source(db).1),
87 DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).1), 87 DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).ast),
88 DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).1), 88 DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).1),
89 } 89 }
90} 90}
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs
index fcccd67c8..b7e255c17 100644
--- a/crates/ra_hir/src/generics.rs
+++ b/crates/ra_hir/src/generics.rs
@@ -81,7 +81,7 @@ impl GenericParams {
81 }); 81 });
82 generics.fill(&*it.source(db).1, start + 1); 82 generics.fill(&*it.source(db).1, start + 1);
83 } 83 }
84 GenericDef::TypeAlias(it) => generics.fill(&*it.source(db).1, start), 84 GenericDef::TypeAlias(it) => generics.fill(&*it.source(db).ast, start),
85 GenericDef::ImplBlock(it) => generics.fill(&*it.source(db).1, start), 85 GenericDef::ImplBlock(it) => generics.fill(&*it.source(db).1, start),
86 } 86 }
87 87
diff --git a/crates/ra_hir/src/type_alias.rs b/crates/ra_hir/src/type_alias.rs
index 970468e3c..c449d7346 100644
--- a/crates/ra_hir/src/type_alias.rs
+++ b/crates/ra_hir/src/type_alias.rs
@@ -8,6 +8,6 @@ pub(crate) fn type_alias_ref_query(
8 db: &(impl DefDatabase + AstDatabase), 8 db: &(impl DefDatabase + AstDatabase),
9 typ: TypeAlias, 9 typ: TypeAlias,
10) -> Arc<TypeRef> { 10) -> Arc<TypeRef> {
11 let (_, node) = typ.source(db); 11 let node = typ.source(db).ast;
12 Arc::new(TypeRef::from_ast_opt(node.type_ref())) 12 Arc::new(TypeRef::from_ast_opt(node.type_ref()))
13} 13}