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 b3c91fea2..ccb682f9a 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::{
@@ -110,6 +111,7 @@ pub struct TypeAliasData {
110 pub name: Name, 111 pub name: Name,
111 pub type_ref: Option<TypeRef>, 112 pub type_ref: Option<TypeRef>,
112 pub visibility: RawVisibility, 113 pub visibility: RawVisibility,
114 pub bounds: Vec<TypeBound>,
113} 115}
114 116
115impl TypeAliasData { 117impl TypeAliasData {
@@ -122,9 +124,17 @@ impl TypeAliasData {
122 let name = node.value.name().map_or_else(Name::missing, |n| n.as_name()); 124 let name = node.value.name().map_or_else(Name::missing, |n| n.as_name());
123 let type_ref = node.value.type_ref().map(TypeRef::from_ast); 125 let type_ref = node.value.type_ref().map(TypeRef::from_ast);
124 let vis_default = RawVisibility::default_for_container(loc.container); 126 let vis_default = RawVisibility::default_for_container(loc.container);
125 let visibility = 127 let visibility = RawVisibility::from_ast_with_default(
126 RawVisibility::from_ast_with_default(db, vis_default, node.map(|n| n.visibility())); 128 db,
127 Arc::new(TypeAliasData { name, type_ref, visibility }) 129 vis_default,
130 node.as_ref().map(|n| n.visibility()),
131 );
132 let bounds = if let Some(bound_list) = node.value.type_bound_list() {
133 bound_list.bounds().map(TypeBound::from_ast).collect()
134 } else {
135 Vec::new()
136 };
137 Arc::new(TypeAliasData { name, type_ref, visibility, bounds })
128 } 138 }
129} 139}
130 140