aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/generics.rs2
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs4
-rw-r--r--crates/ra_hir_def/src/path/lower.rs4
-rw-r--r--crates/ra_hir_def/src/type_ref.rs30
4 files changed, 20 insertions, 20 deletions
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index 8ea61fcf2..be0b45af3 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -253,7 +253,7 @@ impl GenericParams {
253 253
254 fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx, where_clause: ast::WhereClause) { 254 fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx, where_clause: ast::WhereClause) {
255 for pred in where_clause.predicates() { 255 for pred in where_clause.predicates() {
256 let type_ref = match pred.type_ref() { 256 let type_ref = match pred.ty() {
257 Some(type_ref) => type_ref, 257 Some(type_ref) => type_ref,
258 None => continue, 258 None => continue,
259 }; 259 };
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index feb31579e..b5d416acb 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -648,10 +648,10 @@ impl Ctx {
648 self.data().vis.alloc(vis) 648 self.data().vis.alloc(vis)
649 } 649 }
650 650
651 fn lower_type_ref(&self, type_ref: &ast::TypeRef) -> TypeRef { 651 fn lower_type_ref(&self, type_ref: &ast::Type) -> TypeRef {
652 TypeRef::from_ast(&self.body_ctx, type_ref.clone()) 652 TypeRef::from_ast(&self.body_ctx, type_ref.clone())
653 } 653 }
654 fn lower_type_ref_opt(&self, type_ref: Option<ast::TypeRef>) -> TypeRef { 654 fn lower_type_ref_opt(&self, type_ref: Option<ast::Type>) -> TypeRef {
655 type_ref.map(|ty| self.lower_type_ref(&ty)).unwrap_or(TypeRef::Error) 655 type_ref.map(|ty| self.lower_type_ref(&ty)).unwrap_or(TypeRef::Error)
656 } 656 }
657 657
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs
index 07d17916a..257f9a033 100644
--- a/crates/ra_hir_def/src/path/lower.rs
+++ b/crates/ra_hir_def/src/path/lower.rs
@@ -152,7 +152,7 @@ pub(super) fn lower_generic_args(
152) -> Option<GenericArgs> { 152) -> Option<GenericArgs> {
153 let mut args = Vec::new(); 153 let mut args = Vec::new();
154 for type_arg in node.type_args() { 154 for type_arg in node.type_args() {
155 let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.type_ref()); 155 let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
156 args.push(GenericArg::Type(type_ref)); 156 args.push(GenericArg::Type(type_ref));
157 } 157 }
158 // lifetimes ignored for now 158 // lifetimes ignored for now
@@ -161,7 +161,7 @@ pub(super) fn lower_generic_args(
161 let assoc_type_arg: ast::AssocTypeArg = assoc_type_arg; 161 let assoc_type_arg: ast::AssocTypeArg = assoc_type_arg;
162 if let Some(name_ref) = assoc_type_arg.name_ref() { 162 if let Some(name_ref) = assoc_type_arg.name_ref() {
163 let name = name_ref.as_name(); 163 let name = name_ref.as_name();
164 let type_ref = assoc_type_arg.type_ref().map(|it| TypeRef::from_ast(lower_ctx, it)); 164 let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
165 let bounds = if let Some(l) = assoc_type_arg.type_bound_list() { 165 let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
166 l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect() 166 l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
167 } else { 167 } else {
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs
index a5dc10eac..9386b91cb 100644
--- a/crates/ra_hir_def/src/type_ref.rs
+++ b/crates/ra_hir_def/src/type_ref.rs
@@ -80,14 +80,14 @@ pub enum TypeBound {
80 80
81impl TypeRef { 81impl TypeRef {
82 /// Converts an `ast::TypeRef` to a `hir::TypeRef`. 82 /// Converts an `ast::TypeRef` to a `hir::TypeRef`.
83 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self { 83 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::Type) -> Self {
84 match node { 84 match node {
85 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), 85 ast::Type::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
86 ast::TypeRef::TupleType(inner) => { 86 ast::Type::TupleType(inner) => {
87 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) 87 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect())
88 } 88 }
89 ast::TypeRef::NeverType(..) => TypeRef::Never, 89 ast::Type::NeverType(..) => TypeRef::Never,
90 ast::TypeRef::PathType(inner) => { 90 ast::Type::PathType(inner) => {
91 // FIXME: Use `Path::from_src` 91 // FIXME: Use `Path::from_src`
92 inner 92 inner
93 .path() 93 .path()
@@ -95,24 +95,24 @@ impl TypeRef {
95 .map(TypeRef::Path) 95 .map(TypeRef::Path)
96 .unwrap_or(TypeRef::Error) 96 .unwrap_or(TypeRef::Error)
97 } 97 }
98 ast::TypeRef::PointerType(inner) => { 98 ast::Type::PointerType(inner) => {
99 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); 99 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
100 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 100 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
101 TypeRef::RawPtr(Box::new(inner_ty), mutability) 101 TypeRef::RawPtr(Box::new(inner_ty), mutability)
102 } 102 }
103 ast::TypeRef::ArrayType(inner) => { 103 ast::Type::ArrayType(inner) => {
104 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) 104 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
105 } 105 }
106 ast::TypeRef::SliceType(inner) => { 106 ast::Type::SliceType(inner) => {
107 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) 107 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
108 } 108 }
109 ast::TypeRef::ReferenceType(inner) => { 109 ast::Type::ReferenceType(inner) => {
110 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); 110 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
111 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 111 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
112 TypeRef::Reference(Box::new(inner_ty), mutability) 112 TypeRef::Reference(Box::new(inner_ty), mutability)
113 } 113 }
114 ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, 114 ast::Type::PlaceholderType(_inner) => TypeRef::Placeholder,
115 ast::TypeRef::FnPointerType(inner) => { 115 ast::Type::FnPointerType(inner) => {
116 let ret_ty = inner 116 let ret_ty = inner
117 .ret_type() 117 .ret_type()
118 .and_then(|rt| rt.ty()) 118 .and_then(|rt| rt.ty())
@@ -132,17 +132,17 @@ impl TypeRef {
132 TypeRef::Fn(params, is_varargs) 132 TypeRef::Fn(params, is_varargs)
133 } 133 }
134 // for types are close enough for our purposes to the inner type for now... 134 // for types are close enough for our purposes to the inner type for now...
135 ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), 135 ast::Type::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
136 ast::TypeRef::ImplTraitType(inner) => { 136 ast::Type::ImplTraitType(inner) => {
137 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) 137 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
138 } 138 }
139 ast::TypeRef::DynTraitType(inner) => { 139 ast::Type::DynTraitType(inner) => {
140 TypeRef::DynTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) 140 TypeRef::DynTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
141 } 141 }
142 } 142 }
143 } 143 }
144 144
145 pub(crate) fn from_ast_opt(ctx: &LowerCtx, node: Option<ast::TypeRef>) -> Self { 145 pub(crate) fn from_ast_opt(ctx: &LowerCtx, node: Option<ast::Type>) -> Self {
146 if let Some(node) = node { 146 if let Some(node) = node {
147 TypeRef::from_ast(ctx, node) 147 TypeRef::from_ast(ctx, node)
148 } else { 148 } else {