aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/path.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-15 20:02:34 +0000
committerFlorian Diebold <[email protected]>2021-03-16 16:58:17 +0000
commitce2cae45b5242d59b744018dd79bc2ab74670edc (patch)
treedc4ed41e25efae7b6f76fcf18b6b6eb68170e7a9 /crates/hir_ty/src/infer/path.rs
parent00c80b208bcbe52b13bbd03cb62e24b2d2075edf (diff)
Rename Substs -> Substitution
Diffstat (limited to 'crates/hir_ty/src/infer/path.rs')
-rw-r--r--crates/hir_ty/src/infer/path.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs
index af108fb6c..ea01d6238 100644
--- a/crates/hir_ty/src/infer/path.rs
+++ b/crates/hir_ty/src/infer/path.rs
@@ -9,7 +9,7 @@ use hir_def::{
9}; 9};
10use hir_expand::name::Name; 10use hir_expand::name::Name;
11 11
12use crate::{method_resolution, Interner, Substs, Ty, TyKind, ValueTyDefId}; 12use crate::{method_resolution, Interner, Substitution, Ty, TyKind, ValueTyDefId};
13 13
14use super::{ExprOrPatId, InferenceContext, TraitRef}; 14use super::{ExprOrPatId, InferenceContext, TraitRef};
15 15
@@ -79,7 +79,7 @@ impl<'a> InferenceContext<'a> {
79 } 79 }
80 ValueNs::ImplSelf(impl_id) => { 80 ValueNs::ImplSelf(impl_id) => {
81 let generics = crate::utils::generics(self.db.upcast(), impl_id.into()); 81 let generics = crate::utils::generics(self.db.upcast(), impl_id.into());
82 let substs = Substs::type_params_for_generics(self.db, &generics); 82 let substs = Substitution::type_params_for_generics(self.db, &generics);
83 let ty = self.db.impl_self_ty(impl_id).subst(&substs); 83 let ty = self.db.impl_self_ty(impl_id).subst(&substs);
84 if let Some((AdtId::StructId(struct_id), substs)) = ty.as_adt() { 84 if let Some((AdtId::StructId(struct_id), substs)) = ty.as_adt() {
85 let ty = self.db.value_ty(struct_id.into()).subst(&substs); 85 let ty = self.db.value_ty(struct_id.into()).subst(&substs);
@@ -94,10 +94,10 @@ impl<'a> InferenceContext<'a> {
94 94
95 let ty = self.db.value_ty(typable); 95 let ty = self.db.value_ty(typable);
96 // self_subst is just for the parent 96 // self_subst is just for the parent
97 let parent_substs = self_subst.unwrap_or_else(Substs::empty); 97 let parent_substs = self_subst.unwrap_or_else(Substitution::empty);
98 let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); 98 let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver);
99 let substs = ctx.substs_from_path(path, typable, true); 99 let substs = ctx.substs_from_path(path, typable, true);
100 let full_substs = Substs::builder(substs.len()) 100 let full_substs = Substitution::builder(substs.len())
101 .use_parent_substs(&parent_substs) 101 .use_parent_substs(&parent_substs)
102 .fill(substs.0[parent_substs.len()..].iter().cloned()) 102 .fill(substs.0[parent_substs.len()..].iter().cloned())
103 .build(); 103 .build();
@@ -111,7 +111,7 @@ impl<'a> InferenceContext<'a> {
111 path: &Path, 111 path: &Path,
112 remaining_index: usize, 112 remaining_index: usize,
113 id: ExprOrPatId, 113 id: ExprOrPatId,
114 ) -> Option<(ValueNs, Option<Substs>)> { 114 ) -> Option<(ValueNs, Option<Substitution>)> {
115 assert!(remaining_index < path.segments().len()); 115 assert!(remaining_index < path.segments().len());
116 // there may be more intermediate segments between the resolved one and 116 // there may be more intermediate segments between the resolved one and
117 // the end. Only the last segment needs to be resolved to a value; from 117 // the end. Only the last segment needs to be resolved to a value; from
@@ -164,7 +164,7 @@ impl<'a> InferenceContext<'a> {
164 trait_ref: TraitRef, 164 trait_ref: TraitRef,
165 segment: PathSegment<'_>, 165 segment: PathSegment<'_>,
166 id: ExprOrPatId, 166 id: ExprOrPatId,
167 ) -> Option<(ValueNs, Option<Substs>)> { 167 ) -> Option<(ValueNs, Option<Substitution>)> {
168 let trait_ = trait_ref.trait_; 168 let trait_ = trait_ref.trait_;
169 let item = 169 let item =
170 self.db.trait_data(trait_).items.iter().map(|(_name, id)| (*id)).find_map(|item| { 170 self.db.trait_data(trait_).items.iter().map(|(_name, id)| (*id)).find_map(|item| {
@@ -208,7 +208,7 @@ impl<'a> InferenceContext<'a> {
208 ty: Ty, 208 ty: Ty,
209 name: &Name, 209 name: &Name,
210 id: ExprOrPatId, 210 id: ExprOrPatId,
211 ) -> Option<(ValueNs, Option<Substs>)> { 211 ) -> Option<(ValueNs, Option<Substitution>)> {
212 if let TyKind::Unknown = ty.interned(&Interner) { 212 if let TyKind::Unknown = ty.interned(&Interner) {
213 return None; 213 return None;
214 } 214 }
@@ -241,7 +241,7 @@ impl<'a> InferenceContext<'a> {
241 }; 241 };
242 let substs = match container { 242 let substs = match container {
243 AssocContainerId::ImplId(impl_id) => { 243 AssocContainerId::ImplId(impl_id) => {
244 let impl_substs = Substs::build_for_def(self.db, impl_id) 244 let impl_substs = Substitution::build_for_def(self.db, impl_id)
245 .fill(iter::repeat_with(|| self.table.new_type_var())) 245 .fill(iter::repeat_with(|| self.table.new_type_var()))
246 .build(); 246 .build();
247 let impl_self_ty = self.db.impl_self_ty(impl_id).subst(&impl_substs); 247 let impl_self_ty = self.db.impl_self_ty(impl_id).subst(&impl_substs);
@@ -250,7 +250,7 @@ impl<'a> InferenceContext<'a> {
250 } 250 }
251 AssocContainerId::TraitId(trait_) => { 251 AssocContainerId::TraitId(trait_) => {
252 // we're picking this method 252 // we're picking this method
253 let trait_substs = Substs::build_for_def(self.db, trait_) 253 let trait_substs = Substitution::build_for_def(self.db, trait_)
254 .push(ty.clone()) 254 .push(ty.clone())
255 .fill(std::iter::repeat_with(|| self.table.new_type_var())) 255 .fill(std::iter::repeat_with(|| self.table.new_type_var()))
256 .build(); 256 .build();
@@ -274,7 +274,7 @@ impl<'a> InferenceContext<'a> {
274 ty: &Ty, 274 ty: &Ty,
275 name: &Name, 275 name: &Name,
276 id: ExprOrPatId, 276 id: ExprOrPatId,
277 ) -> Option<(ValueNs, Option<Substs>)> { 277 ) -> Option<(ValueNs, Option<Substitution>)> {
278 let (enum_id, subst) = match ty.as_adt() { 278 let (enum_id, subst) = match ty.as_adt() {
279 Some((AdtId::EnumId(e), subst)) => (e, subst), 279 Some((AdtId::EnumId(e), subst)) => (e, subst),
280 _ => return None, 280 _ => return None,