1
Fork 0

Take a slice in stmt_let_pat.

This commit is contained in:
Camille GILLOT 2021-01-04 21:50:45 +01:00
parent 1fb257b3b4
commit 4a21af67e3
3 changed files with 16 additions and 9 deletions

View file

@ -2526,15 +2526,23 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn stmt_let_pat(
&mut self,
attrs: AttrVec,
attrs: &'hir [Attribute],
span: Span,
init: Option<&'hir hir::Expr<'hir>>,
pat: &'hir hir::Pat<'hir>,
source: hir::LocalSource,
) -> hir::Stmt<'hir> {
let hir_id = self.next_id();
self.attrs.push_sparse(hir_id, &*self.arena.alloc_from_iter(attrs.iter().cloned()));
let local = hir::Local { attrs, hir_id, init, pat, source, span, ty: None };
self.attrs.push_sparse(hir_id, attrs);
let local = hir::Local {
attrs: attrs.iter().cloned().collect::<Vec<_>>().into(),
hir_id,
init,
pat,
source,
span,
ty: None,
};
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
}