aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-07-04 08:26:36 +0000
committerGitHub <noreply@github.com>2022-07-04 08:26:36 +0000
commit408b7f87b99c1b9d074787ac279c86319ab00667 (patch)
tree949b4a682cb8bf80db9076bc92db4d5493d46533
parent33912c1a08d3892d3c72506aed38771754b9cf54 (diff)
parentfa006a67280039e0d6c6f574896bb8d819b452fe (diff)
downloadgcc-408b7f87b99c1b9d074787ac279c86319ab00667.zip
gcc-408b7f87b99c1b9d074787ac279c86319ab00667.tar.gz
gcc-408b7f87b99c1b9d074787ac279c86319ab00667.tar.bz2
Merge #1352
1352: HIR: fixup MatchArm assignment operator r=philberty a=dafaust 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. Co-authored-by: David Faust <david.faust@oracle.com>
-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 ());