From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 0816B385842B for ; Wed, 1 Sep 2021 19:24:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0816B385842B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x1b.wildebeest.org [172.31.17.157]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 0D8A4300061B; Wed, 1 Sep 2021 21:23:59 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 80D1B2E81023; Wed, 1 Sep 2021 21:23:59 +0200 (CEST) Date: Wed, 1 Sep 2021 21:23:59 +0200 From: Mark Wielaard To: Philip Herron Cc: gcc-rust@gcc.gnu.org Subject: Re: Cleanup some StructExpr related classes Message-ID: References: <20210901001542.160965-1-mark@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2021 19:24:17 -0000 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