public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Philip Herron <philip.herron@embecosm.com>
Cc: gcc-rust@gcc.gnu.org
Subject: Re: Cleanup some StructExpr related classes
Date: Mon, 6 Sep 2021 00:47:43 +0200	[thread overview]
Message-ID: <YTVJD62V888WgmYa@wildebeest.org> (raw)
In-Reply-To: <CAB2u+n1=b3eQ72ZAx4uZa3ya36V8WuWZn57EhNjRrvEvfY1UQw@mail.gmail.com>

Hi Philip,

On Thu, Sep 02, 2021 at 02:23:33PM +0100, Philip Herron wrote:
> I've been reviewing your branch a bit and noticed this commit
> https://code.wildebeest.org/git/user/mjw/gccrs/commit/?h=enums&id=84d27b926e09ef44dd94be20c97d72bd4b865c40
> which I really like. I wasn't sure what was the best way to interact with
> the AST which contained unique_ptr's to things so I initially added little
> lambda's but these don't really help anything at all other than make it
> more confusing to work with. So feel free to create patches to remove those.

I wasn't sure whether to replicate this for the HIR classes, so at
first I did it with a lambda, but found that not very nice. So instead
I added simple accessors for the fields vector which are the used in
in a simple for loop using get () on the elements. If you also like
that better I can change the AST classes to do the same thing.

> I also noticed quite a few test cases already are these compiling?

Yes, but they are all "negative" tests. I mean, that they check for
errors. After resolving we can check for unused enum item
warnings. After lowering we can detect bad visibility and duplicate
fields in struct variants. And after typechecking (not finished yet)
we can check the denominators of fieldless enums are unique (and
aren't too big).

> you have to add much to the rust-gcc.cc wrapper for the enum type?

I am still stuck at the type check pass. So haven't actually gotten to
that part.

I'll sent the parser, resolve and hit lowering bits, which include the
test cases.

These patches are also on
https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=enums2

Cheers,

Mark

  reply	other threads:[~2021-09-05 22:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  0:15 Mark Wielaard
2021-09-01  0:15 ` [PATCH 1/3] StructExprTuple doesn't really exist Mark Wielaard
2021-09-01  0:15 ` [PATCH 2/3] StructExprUnit " Mark Wielaard
2021-09-01  0:15 ` [PATCH 3/3] Remove Enumaration Expression, EnumExpr, classes Mark Wielaard
2021-09-01 10:11 ` Cleanup some StructExpr related classes Philip Herron
2021-09-01 19:23   ` Mark Wielaard
2021-09-02 13:23     ` Philip Herron
2021-09-05 22:47       ` Mark Wielaard [this message]
2021-09-06 16:55         ` Philip Herron

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=YTVJD62V888WgmYa@wildebeest.org \
    --to=mark@klomp.org \
    --cc=gcc-rust@gcc.gnu.org \
    --cc=philip.herron@embecosm.com \
    /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).