]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: derive(Ord): Fix cmp call to use references instead of values
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 28 Apr 2025 09:35:53 +0000 (11:35 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:48 +0000 (16:36 +0200)
gcc/rust/ChangeLog:

* expand/rust-derive-ord.cc (DeriveOrd::cmp_call): Use references.

gcc/rust/expand/rust-derive-ord.cc

index ffe269c3c0a49654ec6fd9de20a94126956cbd04..1623495b8b60948d3a751155c3bef3f4554a2fdb 100644 (file)
@@ -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>