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 31BB33858408 for ; Sun, 5 Sep 2021 22:47:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 31BB33858408 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 (deer0x19.wildebeest.org [172.31.17.155]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 7D76233C5E9B; Mon, 6 Sep 2021 00:47:44 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id ACCFD2E80ADB; Mon, 6 Sep 2021 00:47:43 +0200 (CEST) Date: Mon, 6 Sep 2021 00:47:43 +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: Sun, 05 Sep 2021 22:47:49 -0000 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