aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2022-07-01 12:35:27 -0700
committerDavid Faust <david.faust@oracle.com>2022-07-01 12:56:34 -0700
commitfa006a67280039e0d6c6f574896bb8d819b452fe (patch)
tree949b4a682cb8bf80db9076bc92db4d5493d46533 /gcc
parent33912c1a08d3892d3c72506aed38771754b9cf54 (diff)
downloadgcc-fa006a67280039e0d6c6f574896bb8d819b452fe.zip
gcc-fa006a67280039e0d6c6f574896bb8d819b452fe.tar.gz
gcc-fa006a67280039e0d6c6f574896bb8d819b452fe.tar.bz2
HIR: fixup MatchArm assignment operator
We overload the assignment operator to clone the vector of patterns for the match arm. However the existing patterns were not cleared before inserting the new ones, so the result was to append the new patterns onto the assignee arm rather than replace them.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/hir/tree/rust-hir-expr.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h
index 789ad78..c695412 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -3827,6 +3827,7 @@ public:
if (other.guard_expr != nullptr)
guard_expr = other.guard_expr->clone_expr ();
+ match_arm_patterns.clear ();
match_arm_patterns.reserve (other.match_arm_patterns.size ());
for (const auto &e : other.match_arm_patterns)
match_arm_patterns.push_back (e->clone_pattern ());