1
Fork 0

Implement .use keyword as an alias of clone

This commit is contained in:
Santiago Pastorino 2024-10-02 16:35:37 -03:00
parent 0cf8dbc96c
commit 05c516446a
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
36 changed files with 247 additions and 24 deletions

View file

@ -207,6 +207,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
},
),
ExprKind::Await(expr, await_kw_span) => self.lower_expr_await(*await_kw_span, expr),
ExprKind::Use(expr, use_kw_span) => self.lower_expr_use(*use_kw_span, expr),
ExprKind::Closure(box Closure {
binder,
capture_clause,
@ -1067,6 +1068,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
)
}
fn lower_expr_use(&mut self, use_kw_span: Span, expr: &Expr) -> hir::ExprKind<'hir> {
hir::ExprKind::Use(self.lower_expr(expr), use_kw_span)
}
fn lower_expr_closure(
&mut self,
binder: &ClosureBinder,