From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 2F7513851A9F; Wed, 8 Jun 2022 12:12:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F7513851A9F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Fix TyTy::ADTType is_equals to always check the variants for equality X-Act-Checkin: gcc X-Git-Author: Philip Herron X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: a64983f86c8703d1229a7e8ee0baff07110f5a7c X-Git-Newrev: fa21267280e488f78fb180704d1a80bee177c6ba Message-Id: <20220608121224.2F7513851A9F@sourceware.org> Date: Wed, 8 Jun 2022 12:12:24 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 12:12:24 -0000 https://gcc.gnu.org/g:fa21267280e488f78fb180704d1a80bee177c6ba commit fa21267280e488f78fb180704d1a80bee177c6ba Author: Philip Herron 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;