aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty.rs7
-rw-r--r--crates/ra_hir/src/ty/infer.rs2
2 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 5cd766b85..7d25ade47 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -148,6 +148,10 @@ impl Substs {
148 self.0.iter() 148 self.0.iter()
149 } 149 }
150 150
151 pub fn len(&self) -> usize {
152 self.0.len()
153 }
154
151 pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { 155 pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) {
152 // Without an Arc::make_mut_slice, we can't avoid the clone here: 156 // Without an Arc::make_mut_slice, we can't avoid the clone here:
153 let mut v: Vec<_> = self.0.iter().cloned().collect(); 157 let mut v: Vec<_> = self.0.iter().cloned().collect();
@@ -286,7 +290,8 @@ impl Ty {
286 /// `Option<u32>` afterwards.) 290 /// `Option<u32>` afterwards.)
287 pub fn apply_substs(self, substs: Substs) -> Ty { 291 pub fn apply_substs(self, substs: Substs) -> Ty {
288 match self { 292 match self {
289 Ty::Apply(ApplicationTy { ctor, .. }) => { 293 Ty::Apply(ApplicationTy { ctor, parameters: previous_substs }) => {
294 assert_eq!(previous_substs.len(), substs.len());
290 Ty::Apply(ApplicationTy { ctor, parameters: substs }) 295 Ty::Apply(ApplicationTy { ctor, parameters: substs })
291 } 296 }
292 _ => self, 297 _ => self,
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index be74b9fa6..bf42befbb 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -817,7 +817,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
817 Some(func.generic_params(self.db)), 817 Some(func.generic_params(self.db)),
818 ) 818 )
819 } 819 }
820 None => (Ty::Unknown, receiver_ty, None), 820 None => (receiver_ty, Ty::Unknown, None),
821 }; 821 };
822 let substs = self.substs_for_method_call(def_generics, generic_args); 822 let substs = self.substs_for_method_call(def_generics, generic_args);
823 let method_ty = method_ty.apply_substs(substs); 823 let method_ty = method_ty.apply_substs(substs);