]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: derive(Copy): Use copy lang item when deriving Copy.
authorArthur Cohen <arthur.cohen@embecosm.com>
Thu, 26 Dec 2024 22:09:11 +0000 (22:09 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:57:50 +0000 (12:57 +0100)
gcc/rust/ChangeLog:

* expand/rust-derive-copy.cc: Use lang item path.

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

index bcfe1db6b4a107472758aaa4d8d291e1b068cde7..31b4819c042970d51518e8cdb9b590b014173c7d 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "rust-derive-copy.h"
 #include "rust-ast-full.h"
+#include "rust-hir-map.h"
 #include "rust-mapping-common.h"
 #include "rust-path.h"
 
@@ -43,12 +44,7 @@ DeriveCopy::copy_impl (
   std::string name,
   const std::vector<std::unique_ptr<GenericParam>> &type_generics)
 {
-  // `$crate::core::marker::Copy` instead
-  auto segments = std::vector<std::unique_ptr<TypePathSegment>> ();
-  segments.emplace_back (builder.type_path_segment ("Copy"));
-
-  auto copy = TypePath (std::move (segments), loc);
-  // auto copy = TypePath (LangItem::Kind::COPY, loc);
+  auto copy = builder.type_path (LangItem::Kind::COPY);
 
   // we need to build up the generics for this impl block which will be just a
   // clone of the types specified ones