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] gccrs: Fix ICE in ADTType::is_concrete Date: Tue, 28 Feb 2023 22:36:59 +0000 (GMT) [thread overview] Message-ID: <20230228223659.86917385841D@sourceware.org> (raw) https://gcc.gnu.org/g:fd849953da2d5a39aa311b5e298bb92cd4b25be4 commit fd849953da2d5a39aa311b5e298bb92cd4b25be4 Author: Philip Herron <herron.philip@googlemail.com> Date: Sun Feb 26 22:36:20 2023 +0000 gccrs: Fix ICE in ADTType::is_concrete Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (ADTType::is_concrete): need to consider if is a num_variant * typecheck/rust-tyty.h: refactor to cc file Diff: --- gcc/rust/typecheck/rust-tyty.cc | 24 ++++++++++++++++++++++++ gcc/rust/typecheck/rust-tyty.h | 18 +----------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index d0d36ac0a11..28d03ce52c5 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -1110,6 +1110,30 @@ ADTType::as_string () const return identifier + subst_as_string () + "{" + variants_buffer + "}"; } +bool +ADTType::is_concrete () const +{ + if (is_unit ()) + { + return !needs_substitution (); + } + + for (auto &variant : variants) + { + bool is_num_variant + = variant->get_variant_type () == VariantDef::VariantType::NUM; + if (is_num_variant) + continue; + + for (auto &field : variant->get_fields ()) + { + if (!field->is_concrete ()) + return false; + } + } + return true; +} + bool ADTType::can_eq (const BaseType *other, bool emit_errors) const { diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 64b9379a1c0..05cd3a78dd8 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -604,23 +604,7 @@ public: return identifier + subst_as_string (); } - bool is_concrete () const override final - { - if (is_unit ()) - { - return !needs_substitution (); - } - - for (auto &variant : variants) - { - for (auto &field : variant->get_fields ()) - { - if (!field->is_concrete ()) - return false; - } - } - return true; - } + bool is_concrete () const override final; BaseType *clone () const final override; BaseType *monomorphized_clone () const final override;
reply other threads:[~2023-02-28 22:36 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=20230228223659.86917385841D@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).