https://gcc.gnu.org/g:0194d12d27518d805d92f58f25ed5202fa835912

commit r16-2868-g0194d12d27518d805d92f58f25ed5202fa835912
Author: Arthur Cohen <arthur.co...@embecosm.com>
Date:   Mon Apr 28 11:35:53 2025 +0200

    gccrs: derive(Ord): Fix cmp call to use references instead of values
    
    gcc/rust/ChangeLog:
    
            * expand/rust-derive-ord.cc (DeriveOrd::cmp_call): Use references.

Diff:
---
 gcc/rust/expand/rust-derive-ord.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/expand/rust-derive-ord.cc 
b/gcc/rust/expand/rust-derive-ord.cc
index ffe269c3c0a4..1623495b8b60 100644
--- a/gcc/rust/expand/rust-derive-ord.cc
+++ b/gcc/rust/expand/rust-derive-ord.cc
@@ -46,7 +46,8 @@ DeriveOrd::cmp_call (std::unique_ptr<Expr> &&self_expr,
     {"core", "cmp", trait (ordering), fn (ordering)}, true);
 
   return builder.call (ptrify (cmp_fn_path),
-                      vec (std::move (self_expr), std::move (other_expr)));
+                      vec (builder.ref (std::move (self_expr)),
+                           builder.ref (std::move (other_expr))));
 }
 
 std::unique_ptr<Item>

Reply via email to