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] Fix TyTy::ADTType is_equals to always check the variants for equality
Date: Wed,  8 Jun 2022 12:12:24 +0000 (GMT)	[thread overview]
Message-ID: <20220608121224.2F7513851A9F@sourceware.org> (raw)

https://gcc.gnu.org/g:fa21267280e488f78fb180704d1a80bee177c6ba

commit fa21267280e488f78fb180704d1a80bee177c6ba
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Thu Feb 24 11:18:35 2022 +0000

    Fix TyTy::ADTType is_equals to always check the variants for equality

Diff:
---
 gcc/rust/typecheck/rust-tyty.cc | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 0dde2998bf2..a58e1cdb4c4 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -840,16 +840,14 @@ ADTType::is_equal (const BaseType &other) const
 	    return false;
 	}
     }
-  else
+
+  for (size_t i = 0; i < number_of_variants (); i++)
     {
-      for (size_t i = 0; i < number_of_variants (); i++)
-	{
-	  const TyTy::VariantDef *a = get_variants ().at (i);
-	  const TyTy::VariantDef *b = other2.get_variants ().at (i);
+      const TyTy::VariantDef *a = get_variants ().at (i);
+      const TyTy::VariantDef *b = other2.get_variants ().at (i);
 
-	  if (!a->is_equal (*b))
-	    return false;
-	}
+      if (!a->is_equal (*b))
+	return false;
     }
 
   return true;


                 reply	other threads:[~2022-06-08 12:12 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=20220608121224.2F7513851A9F@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: link
Be 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).