aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/data.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index 56a20c5bd..5dfde75d9 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -9,7 +9,8 @@ use hir_expand::{
9}; 9};
10use ra_prof::profile; 10use ra_prof::profile;
11use ra_syntax::ast::{ 11use ra_syntax::ast::{
12 self, AstNode, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner, VisibilityOwner, 12 self, AstNode, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner, TypeBoundsOwner,
13 VisibilityOwner,
13}; 14};
14 15
15use crate::{ 16use crate::{
@@ -106,6 +107,7 @@ pub struct TypeAliasData {
106 pub name: Name, 107 pub name: Name,
107 pub type_ref: Option<TypeRef>, 108 pub type_ref: Option<TypeRef>,
108 pub visibility: RawVisibility, 109 pub visibility: RawVisibility,
110 pub bounds: Vec<TypeBound>,
109} 111}
110 112
111impl TypeAliasData { 113impl TypeAliasData {
@@ -118,9 +120,17 @@ impl TypeAliasData {
118 let name = node.value.name().map_or_else(Name::missing, |n| n.as_name()); 120 let name = node.value.name().map_or_else(Name::missing, |n| n.as_name());
119 let type_ref = node.value.type_ref().map(TypeRef::from_ast); 121 let type_ref = node.value.type_ref().map(TypeRef::from_ast);
120 let vis_default = RawVisibility::default_for_container(loc.container); 122 let vis_default = RawVisibility::default_for_container(loc.container);
121 let visibility = 123 let visibility = RawVisibility::from_ast_with_default(
122 RawVisibility::from_ast_with_default(db, vis_default, node.map(|n| n.visibility())); 124 db,
123 Arc::new(TypeAliasData { name, type_ref, visibility }) 125 vis_default,
126 node.as_ref().map(|n| n.visibility()),
127 );
128 let bounds = if let Some(bound_list) = node.value.type_bound_list() {
129 bound_list.bounds().map(TypeBound::from_ast).collect()
130 } else {
131 Vec::new()
132 };
133 Arc::new(TypeAliasData { name, type_ref, visibility, bounds })
124 } 134 }
125} 135}
126 136