aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-derive-clone.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2025-04-25 16:02:12 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-04-28 11:08:30 +0000
commitb22c7d8df0b3adb17d26f302d192bef1816d5bca (patch)
tree86c4a94ebc7b07db29312ceee294fb3a83b350b4 /gcc/rust/expand/rust-derive-clone.cc
parentee61e8917f0057e271177c5ad2e5a4a7c3ccdbaa (diff)
downloadgcc-b22c7d8df0b3adb17d26f302d192bef1816d5bca.zip
gcc-b22c7d8df0b3adb17d26f302d192bef1816d5bca.tar.gz
gcc-b22c7d8df0b3adb17d26f302d192bef1816d5bca.tar.bz2
Completely duplicate path node
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>
Diffstat (limited to 'gcc/rust/expand/rust-derive-clone.cc')
-rw-r--r--gcc/rust/expand/rust-derive-clone.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-derive-clone.cc b/gcc/rust/expand/rust-derive-clone.cc
index ca5ef0e..b47c21d 100644
--- a/gcc/rust/expand/rust-derive-clone.cc
+++ b/gcc/rust/expand/rust-derive-clone.cc
@@ -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));
}