From patchwork Tue Jan 31 13:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 63991 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CBBA38389FC for ; Tue, 31 Jan 2023 13:24:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 6CDA73889E2B for ; Tue, 31 Jan 2023 13:22:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CDA73889E2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x331.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso4418408wmp.3 for ; Tue, 31 Jan 2023 05:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xEIVl8j7SwllriuEz8bML0FaIwuQ1J8xIqRzM2EFad4=; b=JFtkRcNTyOrp1xEajLmi7RGgaEg7VWN4O1jjsS8dZbJMrh8zYTvPnG/IRm++eEwmU1 oUuUrlkM8nsXgAHOLx4Oqwjy+vhnCpHW5BlNCbj9ygY2pGLsjsAEneKZ+C1cV7yQcx+B a0CeInVRU64lGz4PKEp109iT1lvUS+gjED1ZS5L4hhbZCMGm2xtsfqmZWiMxbD/KIov9 zHn7fXM/chaW+8pWy6VI0sow9C+hPDN6zz09s7FMbZ02o1irxBPMxictmMNgCL9o+nBi 5haKiiB7ok5fzAo51UDCsfDdqXLM4cCiDnUfplj0Qp0VYVz6XZChRQVh5Pob7kLca3W5 DiBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xEIVl8j7SwllriuEz8bML0FaIwuQ1J8xIqRzM2EFad4=; b=zL3Y3ZxwIFMIByb77y0QlA/J7j41qZ9KocyHCy0GyS9YqJ58WEFaU5n6CTT4RYjs03 tY1MfgJSyj3xEaOKSx+lXfk7ULlK2INY2cJqzf2MtpPeA7eDnUeBrGA2cDrlEgfQCSnV D7orbEIPChNUZj/aaoq0n1FR4mXX32FKRY8hPRIsoWgZWPzVfhKdGf+TEFUSmfU6aHzq NEqy69pQUJTRCBaFJQhfK8/LeVQ37R+688zLzfpv6KfwU3GDMypvzD7oWSop9s9wGEXv rBAsUuKOMX4v7HYsh8kY92W2C4OA+y3dvqz3sukGP7fwiDt0Ik72kmas4nHQSyYx0DRZ oX1w== X-Gm-Message-State: AO0yUKUjFSYvZTM/rDd8H2mbcK+krbSF79VEBMJaSwp/wHOh7kLS/SHJ o+2gyIg7LCLbOAnRdQnmVutPX61fc5NVIG/ulQ== X-Google-Smtp-Source: AK7set8/fIIIaLe8ocl2okDRdBCvta1BDnO0h2GfCtAUJ37S/eeK4RP8xMf+rgjtAN/Xc3UXrTXj/g== X-Received: by 2002:a05:600c:188a:b0:3dc:506e:6559 with SMTP id x10-20020a05600c188a00b003dc506e6559mr11868654wmp.37.1675171325079; Tue, 31 Jan 2023 05:22:05 -0800 (PST) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003dc3f07c876sm13260932wmc.46.2023.01.31.05.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 05:22:04 -0800 (PST) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [COMMITTED] gccrs: Unit structs are not concrete when they need substitutions Date: Tue, 31 Jan 2023 14:25:50 +0100 Message-Id: <20230131132550.662527-1-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Philip Herron Fixes #1518 gcc/rust/ChangeLog: * typecheck/rust-tyty.h: Fix `is_concrete` for unit types with substitutions. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/rust/typecheck/rust-tyty.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 24efc7aa54c..43460d2dd2f 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -1362,6 +1362,11 @@ public: bool is_concrete () const override final { + if (is_unit ()) + { + return !needs_substitution (); + } + for (auto &variant : variants) { for (auto &field : variant->get_fields ())