public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] HIR: fixup MatchArm assignment operator Date: Mon, 4 Jul 2022 18:57:41 +0000 (GMT) [thread overview] Message-ID: <20220704185741.84DDA38582A2@sourceware.org> (raw) https://gcc.gnu.org/g:fa006a67280039e0d6c6f574896bb8d819b452fe commit fa006a67280039e0d6c6f574896bb8d819b452fe Author: David Faust <david.faust@oracle.com> Date: Fri Jul 1 12:35:27 2022 -0700 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. Diff: --- gcc/rust/hir/tree/rust-hir-expr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 789ad78ffa2..c695412e766 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 ());
reply other threads:[~2022-07-04 18:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220704185741.84DDA38582A2@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).