Complete field replacing

This commit is contained in:
Dawer 2021-05-02 20:56:54 +05:00
parent 3a85e47f6a
commit 3ffcb2658c

View File

@ -811,8 +811,13 @@ pub(super) fn replace_fields(
pats: impl IntoIterator<Item = Pat>,
) -> 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 {