diff options
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 4 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/path.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 2 |
4 files changed, 5 insertions, 9 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index c584a2c08..a87429a24 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -452,11 +452,7 @@ impl<'a> InferenceContext<'a> { | |||
452 | }; | 452 | }; |
453 | match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { | 453 | match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { |
454 | TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { | 454 | TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { |
455 | substs | 455 | substs.interned().get(idx).map(|a| a.assert_ty_ref(&Interner)).cloned() |
456 | .interned(&Interner) | ||
457 | .get(idx) | ||
458 | .map(|a| a.assert_ty_ref(&Interner)) | ||
459 | .cloned() | ||
460 | }), | 456 | }), |
461 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { | 457 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { |
462 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; | 458 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 5b70d5e5a..469f37dd9 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -123,7 +123,7 @@ impl<'a> InferenceContext<'a> { | |||
123 | let ty = match &body[pat] { | 123 | let ty = match &body[pat] { |
124 | &Pat::Tuple { ref args, ellipsis } => { | 124 | &Pat::Tuple { ref args, ellipsis } => { |
125 | let expectations = match expected.as_tuple() { | 125 | let expectations = match expected.as_tuple() { |
126 | Some(parameters) => &*parameters.0, | 126 | Some(parameters) => &*parameters.interned(), |
127 | _ => &[], | 127 | _ => &[], |
128 | }; | 128 | }; |
129 | 129 | ||
@@ -239,7 +239,7 @@ impl<'a> InferenceContext<'a> { | |||
239 | let (inner_ty, alloc_ty) = match expected.as_adt() { | 239 | let (inner_ty, alloc_ty) = match expected.as_adt() { |
240 | Some((adt, subst)) if adt == box_adt => ( | 240 | Some((adt, subst)) if adt == box_adt => ( |
241 | subst.at(&Interner, 0).assert_ty_ref(&Interner).clone(), | 241 | subst.at(&Interner, 0).assert_ty_ref(&Interner).clone(), |
242 | subst.interned(&Interner).get(1).and_then(|a| a.ty(&Interner).cloned()), | 242 | subst.interned().get(1).and_then(|a| a.ty(&Interner).cloned()), |
243 | ), | 243 | ), |
244 | _ => (self.result.standard_types.unknown.clone(), None), | 244 | _ => (self.result.standard_types.unknown.clone(), None), |
245 | }; | 245 | }; |
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 671ea355f..637341b53 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
@@ -98,7 +98,7 @@ impl<'a> InferenceContext<'a> { | |||
98 | let substs = ctx.substs_from_path(path, typable, true); | 98 | let substs = ctx.substs_from_path(path, typable, true); |
99 | let ty = TyBuilder::value_ty(self.db, typable) | 99 | let ty = TyBuilder::value_ty(self.db, typable) |
100 | .use_parent_substs(&parent_substs) | 100 | .use_parent_substs(&parent_substs) |
101 | .fill(substs.interned(&Interner)[parent_substs.len(&Interner)..].iter().cloned()) | 101 | .fill(substs.interned()[parent_substs.len(&Interner)..].iter().cloned()) |
102 | .build(); | 102 | .build(); |
103 | Some(ty) | 103 | Some(ty) |
104 | } | 104 | } |
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index a04b935ef..b7bc48569 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -284,7 +284,7 @@ impl InferenceTable { | |||
284 | substs2: &Substitution, | 284 | substs2: &Substitution, |
285 | depth: usize, | 285 | depth: usize, |
286 | ) -> bool { | 286 | ) -> bool { |
287 | substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| { | 287 | substs1.iter(&Interner).zip(substs2.iter(&Interner)).all(|(t1, t2)| { |
288 | self.unify_inner(t1.assert_ty_ref(&Interner), t2.assert_ty_ref(&Interner), depth) | 288 | self.unify_inner(t1.assert_ty_ref(&Interner), t2.assert_ty_ref(&Interner), depth) |
289 | }) | 289 | }) |
290 | } | 290 | } |