From 3ffcb2658cc2199271d3a22f9747517d8e2892d6 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Sun, 2 May 2021 20:56:54 +0500 Subject: Complete field replacing --- crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs index 393d99997..d3513c406 100644 --- a/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs +++ b/crates/hir_ty/src/diagnostics/pattern/deconstruct_pat.rs @@ -811,8 +811,13 @@ impl Fields { pats: impl IntoIterator, ) -> Self { let pats = { - let mut arena = cx.pattern_arena.borrow_mut(); - pats.into_iter().map(move |pat| /* arena.alloc(pat) */ todo!()).collect() + let tys: SmallVec<[Ty; 2]> = match self { + Fields::Vec(pats) => pats.iter().copied().map(|pat| cx.type_of(pat)).collect(), + }; + pats.into_iter() + .zip(tys.into_iter()) + .map(move |(pat, ty)| cx.alloc_pat(pat, &ty)) + .collect() }; match self { -- cgit v1.2.3