aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r--crates/ra_hir_ty/src/infer/pat.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs
index bf8ea192b..623e52599 100644
--- a/crates/ra_hir_ty/src/infer/pat.rs
+++ b/crates/ra_hir_ty/src/infer/pat.rs
@@ -185,6 +185,23 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
185 self.write_pat_ty(pat, bound_ty); 185 self.write_pat_ty(pat, bound_ty);
186 return inner_ty; 186 return inner_ty;
187 } 187 }
188 Pat::Slice { prefix, slice: _slice, suffix } => {
189 let (container_ty, elem_ty) = match &expected {
190 ty_app!(TypeCtor::Array, st) => {
191 (TypeCtor::Array, st.as_single().clone())
192 },
193 ty_app!(TypeCtor::Slice, st) => {
194 (TypeCtor::Slice, st.as_single().clone())
195 },
196 _ => (TypeCtor::Slice, Ty::Unknown),
197 };
198
199 for pat_id in prefix.iter().chain(suffix) {
200 self.infer_pat(*pat_id, &elem_ty, default_bm);
201 }
202
203 Ty::apply_one(container_ty, elem_ty)
204 }
188 _ => Ty::Unknown, 205 _ => Ty::Unknown,
189 }; 206 };
190 // use a new type variable if we got Ty::Unknown here 207 // use a new type variable if we got Ty::Unknown here