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: Wed, 1 Sep 2021 21:23:59 +0200	[thread overview]
Message-ID: <YS/TT4KIec1ZqBhY@wildebeest.org> (raw)
In-Reply-To: <CAB2u+n0wfYbd6kbSX=Dw0-BwuDTTiXhVORy9W6F3PvW4xHV2uA@mail.gmail.com>

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


  reply	other threads:[~2021-09-01 19:24 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 [this message]
2021-09-02 13:23     ` Philip Herron
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=YS/TT4KIec1ZqBhY@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).