]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Completely duplicate path node
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 25 Apr 2025 14:02:12 +0000 (16:02 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 28 Apr 2025 14:19:29 +0000 (16:19 +0200)
Both nodes had the same id, this led to a resolution conflict.

gcc/rust/ChangeLog:

* expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): Clone
path to avoid using the same nodeid.

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: Remove now passing test from exclusion
list.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/expand/rust-derive-clone.cc
gcc/testsuite/rust/compile/nr2/exclude

index a955b581acd527a2f295b3b3e3b641e02d56a364..321fa00d2ec891ef7138e43e32db9044edc80e9e 100644 (file)
@@ -293,8 +293,14 @@ DeriveClone::clone_enum_struct (PathInExpression variant_path,
     new ReferencePattern (std::unique_ptr<Pattern> (new StructPattern (
                            variant_path, loc, pattern_elts)),
                          false, false, loc));
+
+  PathInExpression new_path (variant_path.get_segments (),
+                            variant_path.get_outer_attrs (),
+                            variant_path.get_locus (),
+                            variant_path.opening_scope_resolution ());
+
   auto expr = std::unique_ptr<Expr> (
-    new StructExprStructFields (variant_path, std::move (cloned_fields), loc));
+    new StructExprStructFields (new_path, std::move (cloned_fields), loc));
 
   return builder.match_case (std::move (pattern), std::move (expr));
 }
index fac66a7de2c1ebf21d0a75a1af68965e10004480..c020e36fba4ae3f7f723f94bfcf6754d6049aaa2 100644 (file)
@@ -6,7 +6,6 @@ pub_restricted_1.rs
 pub_restricted_2.rs
 pub_restricted_3.rs
 issue-2905-2.rs
-derive_clone_enum3.rs
 derive-default1.rs
 derive-eq-invalid.rs
 torture/alt_patterns1.rs