remove a couple clones

This commit is contained in:
Matthias Krüger 2025-04-19 18:11:57 +02:00
parent 49e5e4e3a5
commit de9323973a
2 changed files with 5 additions and 7 deletions

View file

@ -596,15 +596,14 @@ mod llvm_enzyme {
} }
}; };
let arg = ty.kind.is_simple_path().unwrap(); let arg = ty.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default]; let tmp = ecx.def_site_path(&[arg, kw::Default]);
let tmp = ecx.def_site_path(&sl);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp)); let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]); let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
body.stmts.push(ecx.stmt_expr(default_call_expr)); body.stmts.push(ecx.stmt_expr(default_call_expr));
return body; return body;
} }
let mut exprs: P<ast::Expr> = primal_call.clone(); let mut exprs: P<ast::Expr> = primal_call;
let d_ret_ty = match d_sig.decl.output { let d_ret_ty = match d_sig.decl.output {
FnRetTy::Ty(ref ty) => ty.clone(), FnRetTy::Ty(ref ty) => ty.clone(),
FnRetTy::Default(span) => { FnRetTy::Default(span) => {
@ -622,7 +621,7 @@ mod llvm_enzyme {
// type due to the Const return activity. // type due to the Const return activity.
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]); exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
} else { } else {
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 }; let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
let y = let y =
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default"))); ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
let default_call_expr = ecx.expr(span, y); let default_call_expr = ecx.expr(span, y);
@ -640,8 +639,7 @@ mod llvm_enzyme {
let mut exprs2 = thin_vec![exprs]; let mut exprs2 = thin_vec![exprs];
for arg in args.iter().skip(1) { for arg in args.iter().skip(1) {
let arg = arg.kind.is_simple_path().unwrap(); let arg = arg.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default]; let tmp = ecx.def_site_path(&[arg, kw::Default]);
let tmp = ecx.def_site_path(&sl);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp)); let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = let default_call_expr =
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]); ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);

View file

@ -1530,7 +1530,7 @@ fn build_scope_drops<'tcx>(
// path, then don't generate the drop. (We only take this into // path, then don't generate the drop. (We only take this into
// account for non-unwind paths so as not to disturb the // account for non-unwind paths so as not to disturb the
// caching mechanism.) // caching mechanism.)
if scope.moved_locals.iter().any(|&o| o == local) { if scope.moved_locals.contains(&local) {
continue; continue;
} }