diff options
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 8 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 2369c9bef..13240f790 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -82,7 +82,7 @@ impl<'a> InferenceContext<'a> { | |||
82 | arg_tys.push(arg); | 82 | arg_tys.push(arg); |
83 | } | 83 | } |
84 | let parameters = param_builder.build(); | 84 | let parameters = param_builder.build(); |
85 | let arg_ty = Ty::Tuple { cardinality: num_args as u16, substs: parameters }; | 85 | let arg_ty = Ty::Tuple(num_args, parameters); |
86 | let substs = | 86 | let substs = |
87 | Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build(); | 87 | Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build(); |
88 | 88 | ||
@@ -424,7 +424,7 @@ impl<'a> InferenceContext<'a> { | |||
424 | }, | 424 | }, |
425 | ) | 425 | ) |
426 | .find_map(|derefed_ty| match canonicalized.decanonicalize_ty(derefed_ty.value) { | 426 | .find_map(|derefed_ty| match canonicalized.decanonicalize_ty(derefed_ty.value) { |
427 | Ty::Tuple { substs, .. } => { | 427 | Ty::Tuple(_, substs) => { |
428 | name.as_tuple_index().and_then(|idx| substs.0.get(idx).cloned()) | 428 | name.as_tuple_index().and_then(|idx| substs.0.get(idx).cloned()) |
429 | } | 429 | } |
430 | Ty::Adt(AdtId::StructId(s), parameters) => { | 430 | Ty::Adt(AdtId::StructId(s), parameters) => { |
@@ -635,7 +635,7 @@ impl<'a> InferenceContext<'a> { | |||
635 | } | 635 | } |
636 | Expr::Tuple { exprs } => { | 636 | Expr::Tuple { exprs } => { |
637 | let mut tys = match &expected.ty { | 637 | let mut tys = match &expected.ty { |
638 | Ty::Tuple { substs, .. } => substs | 638 | Ty::Tuple(_, substs) => substs |
639 | .iter() | 639 | .iter() |
640 | .cloned() | 640 | .cloned() |
641 | .chain(repeat_with(|| self.table.new_type_var())) | 641 | .chain(repeat_with(|| self.table.new_type_var())) |
@@ -648,7 +648,7 @@ impl<'a> InferenceContext<'a> { | |||
648 | self.infer_expr_coerce(*expr, &Expectation::has_type(ty.clone())); | 648 | self.infer_expr_coerce(*expr, &Expectation::has_type(ty.clone())); |
649 | } | 649 | } |
650 | 650 | ||
651 | Ty::Tuple { cardinality: tys.len() as u16, substs: Substs(tys.into()) } | 651 | Ty::Tuple(tys.len(), Substs(tys.into())) |
652 | } | 652 | } |
653 | Expr::Array(array) => { | 653 | Expr::Array(array) => { |
654 | let elem_ty = match &expected.ty { | 654 | let elem_ty = match &expected.ty { |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index e96e08c3c..a318e47f3 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -138,7 +138,7 @@ impl<'a> InferenceContext<'a> { | |||
138 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); | 138 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); |
139 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); | 139 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); |
140 | 140 | ||
141 | Ty::Tuple { cardinality: inner_tys.len() as u16, substs: Substs(inner_tys.into()) } | 141 | Ty::Tuple(inner_tys.len(), Substs(inner_tys.into())) |
142 | } | 142 | } |
143 | Pat::Or(ref pats) => { | 143 | Pat::Or(ref pats) => { |
144 | if let Some((first_pat, rest)) = pats.split_first() { | 144 | if let Some((first_pat, rest)) = pats.split_first() { |