From: Philip Herron <philip.herron@embecosm.com>
To: Mark Wielaard <mark@klomp.org>
Cc: gcc-rust@gcc.gnu.org
Subject: Re: Cleanup some StructExpr related classes
Date: Thu, 2 Sep 2021 14:23:33 +0100 [thread overview]
Message-ID: <CAB2u+n1=b3eQ72ZAx4uZa3ya36V8WuWZn57EhNjRrvEvfY1UQw@mail.gmail.com> (raw)
In-Reply-To: <YS/TT4KIec1ZqBhY@wildebeest.org>
[-- Attachment #1: Type: text/plain, Size: 2432 bytes --]
Hi Mark,
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 also noticed quite a few test cases already are these compiling? And did
you have to add much to the rust-gcc.cc wrapper for the enum type?
Thanks,
--Phil
On Wed, 1 Sept 2021 at 20:24, Mark Wielaard <mark@klomp.org> wrote:
> Hi,
>
> On Wed, Sep 01, 2021 at 11:11:46AM +0100, Philip Herron wrote:
> > This is fantastic work Mar. This brings us closer to the AST structures
> of
> > rustc and does simplify a lot of the analysis within the compiler.
> > https://doc.rust-lang.org/nightly/reference/expressions/struct-expr.html
>
> The reference does change from time to time. The older one did
> describe various constructs that the newer does and for some it still
> has comments saying some construct doesn't really construct, like the
> tuple expression, which is simply a call (constructor) expression. I
> don't know if there is some kind of change log for the Rust reference.
>
> Note that there are some more StructExpr cleanups at:
> https://github.com/Rust-GCC/gccrs/pull/405
> Which might be nice to finish.
>
> > I agree the HIR cleanup will also help reduce a lot of duplication of
> code
> > and visitors. It might mean we get alot of enum stuff for free
> potentially.
>
> Potentially yes, but in practice enum item variants are different
> enough to require lots of new code. I have patches for the parser,
> resolver, and ast-hir-lowering and working on type-checking. One
> tricky issue is that references to an enum item are paths with the
> enum name first and the enum item second (Enum::Item). Which is
> somewhat more complex than the IdentifierExpr. Another is that a
> struct has one constructor, an enum has multiple (depending on the
> enum item variant). So you need to add variants to the ADTType.
>
> Work in progress at
> https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=enums
> cleaned up patches (that I hope are correct) at
> https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=enums2
>
> Cheers,
>
> Mark
>
>
[-- Attachment #2: Type: text/html, Size: 3513 bytes --]
next prev parent reply other threads:[~2021-09-02 13:23 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 [this message]
2021-09-05 22:47 ` Mark Wielaard
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='CAB2u+n1=b3eQ72ZAx4uZa3ya36V8WuWZn57EhNjRrvEvfY1UQw@mail.gmail.com' \
--to=philip.herron@embecosm.com \
--cc=gcc-rust@gcc.gnu.org \
--cc=mark@klomp.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).