aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r--crates/ra_hir/src/ty/infer.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 887153484..d8f4ce9f8 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -1074,7 +1074,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1074 1074
1075 Ty::apply(TypeCtor::Tuple, Substs(ty_vec.into())) 1075 Ty::apply(TypeCtor::Tuple, Substs(ty_vec.into()))
1076 } 1076 }
1077 Expr::Array { exprs } => { 1077 Expr::Array { exprs, repeat } => {
1078 let elem_ty = match &expected.ty { 1078 let elem_ty = match &expected.ty {
1079 Ty::Apply(a_ty) => match a_ty.ctor { 1079 Ty::Apply(a_ty) => match a_ty.ctor {
1080 TypeCtor::Slice | TypeCtor::Array => { 1080 TypeCtor::Slice | TypeCtor::Array => {
@@ -1089,6 +1089,15 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1089 self.infer_expr(*expr, &Expectation::has_type(elem_ty.clone())); 1089 self.infer_expr(*expr, &Expectation::has_type(elem_ty.clone()));
1090 } 1090 }
1091 1091
1092 if let Some(expr) = repeat {
1093 self.infer_expr(
1094 *expr,
1095 &Expectation::has_type(Ty::simple(TypeCtor::Int(
1096 primitive::UncertainIntTy::Known(primitive::IntTy::usize()),
1097 ))),
1098 );
1099 }
1100
1092 Ty::apply_one(TypeCtor::Array, elem_ty) 1101 Ty::apply_one(TypeCtor::Array, elem_ty)
1093 } 1102 }
1094 Expr::Literal(lit) => match lit { 1103 Expr::Literal(lit) => match lit {