aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r--crates/hir_ty/src/infer/expr.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 796487d02..53d94fd0d 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -15,7 +15,7 @@ use stdx::always;
15use syntax::ast::RangeOp; 15use syntax::ast::RangeOp;
16 16
17use crate::{ 17use crate::{
18 autoderef, 18 autoderef, dummy_usize_const,
19 lower::lower_to_chalk_mutability, 19 lower::lower_to_chalk_mutability,
20 method_resolution, op, 20 method_resolution, op,
21 primitive::{self, UintTy}, 21 primitive::{self, UintTy},
@@ -702,7 +702,7 @@ impl<'a> InferenceContext<'a> {
702 } 702 }
703 Expr::Array(array) => { 703 Expr::Array(array) => {
704 let elem_ty = match expected.ty.kind(&Interner) { 704 let elem_ty = match expected.ty.kind(&Interner) {
705 TyKind::Array(st) | TyKind::Slice(st) => st.clone(), 705 TyKind::Array(st, _) | TyKind::Slice(st) => st.clone(),
706 _ => self.table.new_type_var(), 706 _ => self.table.new_type_var(),
707 }; 707 };
708 708
@@ -726,7 +726,7 @@ impl<'a> InferenceContext<'a> {
726 } 726 }
727 } 727 }
728 728
729 TyKind::Array(elem_ty).intern(&Interner) 729 TyKind::Array(elem_ty, dummy_usize_const()).intern(&Interner)
730 } 730 }
731 Expr::Literal(lit) => match lit { 731 Expr::Literal(lit) => match lit {
732 Literal::Bool(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner), 732 Literal::Bool(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner),
@@ -736,7 +736,8 @@ impl<'a> InferenceContext<'a> {
736 } 736 }
737 Literal::ByteString(..) => { 737 Literal::ByteString(..) => {
738 let byte_type = TyKind::Scalar(Scalar::Uint(UintTy::U8)).intern(&Interner); 738 let byte_type = TyKind::Scalar(Scalar::Uint(UintTy::U8)).intern(&Interner);
739 let array_type = TyKind::Array(byte_type).intern(&Interner); 739 let array_type =
740 TyKind::Array(byte_type, dummy_usize_const()).intern(&Interner);
740 TyKind::Ref(Mutability::Not, static_lifetime(), array_type).intern(&Interner) 741 TyKind::Ref(Mutability::Not, static_lifetime(), array_type).intern(&Interner)
741 } 742 }
742 Literal::Char(..) => TyKind::Scalar(Scalar::Char).intern(&Interner), 743 Literal::Char(..) => TyKind::Scalar(Scalar::Char).intern(&Interner),