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 9397038515EE for ; Mon, 28 Jun 2021 22:47:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9397038515EE 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 (deer0x0c.wildebeest.org [172.31.17.142]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 3879730012FB; Tue, 29 Jun 2021 00:47:08 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id BDD202E80146; Tue, 29 Jun 2021 00:47:07 +0200 (CEST) Date: Tue, 29 Jun 2021 00:47:07 +0200 From: Mark Wielaard To: Marc Cc: gcc-rust@gcc.gnu.org Subject: Re: [PATCH] Suppress warning in rust-ast-lower-type.h ASTLowerGenericParam.visit. Message-ID: References: <20210628214147.256049-1-mark@klomp.org> <87pmw53apr.fsf@arrakis.kataplop.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87pmw53apr.fsf@arrakis.kataplop.net> X-Spam-Status: No, score=-4.8 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 28 Jun 2021 22:47:10 -0000 On Tue, Jun 29, 2021 at 12:06:56AM +0200, Marc wrote: > Hi, > > > Translating the AST LifetimeType to the HIR LifetimeType causes a warning: > > warning: ‘ltt’ may be used uninitialized > > Was wondering why this is needed as the switch case covers all enum > variants, how can ltt be uninitialized ? I have the same fix locally but > was thinking something else was causing the error... LifetimeType is a plain enum, which aren't really their own types, they are really just ints with fancy names. We could make them enum class, which is a strong type. Then the compiler would know the switch really covers all enum (class) variants. But then we have to provide the right scope/type everywhere we use them in the code (which might be a good idea, but is more typing). Cheers, Mark