aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer
diff options
context:
space:
mode:
authorcynecx <[email protected]>2021-02-28 20:15:26 +0000
committercynecx <[email protected]>2021-02-28 20:18:30 +0000
commit2cdd1ff1b50b7c71e9f8aaf03a58501a4af97dce (patch)
treeb581a78b79b40bffbe72c2fd7241ded8caea97b3 /crates/hir_ty/src/infer
parent23d7dbfa5e7ba2cebf8c3f79b5d31285d79c1527 (diff)
hir_ty: use default type generic for box expressions
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r--crates/hir_ty/src/infer/expr.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 13240f790..98bc23173 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -488,6 +488,12 @@ impl<'a> InferenceContext<'a> {
488 if let Some(box_) = self.resolve_boxed_box() { 488 if let Some(box_) = self.resolve_boxed_box() {
489 let mut sb = Substs::builder(generics(self.db.upcast(), box_.into()).len()); 489 let mut sb = Substs::builder(generics(self.db.upcast(), box_.into()).len());
490 sb = sb.push(inner_ty); 490 sb = sb.push(inner_ty);
491 match self.db.generic_defaults(box_.into()).as_ref() {
492 [_, alloc_ty, ..] if !alloc_ty.value.is_unknown() => {
493 sb = sb.push(alloc_ty.value.clone());
494 }
495 _ => (),
496 }
491 sb = sb.fill(repeat_with(|| self.table.new_type_var())); 497 sb = sb.fill(repeat_with(|| self.table.new_type_var()));
492 Ty::Adt(box_, sb.build()) 498 Ty::Adt(box_, sb.build())
493 } else { 499 } else {