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
--
Gcc-rust mailing list
Gcc-rust@gcc.gnu.org
https://gcc.gnu.org/mailman/listinfo/gcc-rust