From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 2ED8A3857C6F for ; Tue, 30 Jan 2024 12:11:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2ED8A3857C6F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2ED8A3857C6F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616728; cv=none; b=rICQDvLMRbrRJcxuelGaVXTcW8s/9eNGwkKxM3qmhMiIPC2inxlf7wXRf6VeoNEVbqqRBC0ng4cxtn/C+QGAdtv/X+bSd8mguOjVESU2SvT/bNGP3C2GK1JYISZ/8mYJtj42/0O+Lt6amWzXkLRJteh1lhR5Kg37OqBlzKqdrzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616728; c=relaxed/simple; bh=eq7IBo/lpEMkBfsicakGZ41Mgu3FWfx1YuVMjP7ZaRo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MOLpVIBxAOjv5fidtYn5r3awsEW55uh3u5qS5jl+7QjCsZkSeOFAhaDT1V9ZxVOfN0izWIDsgSCgZok8lmMlWmGlis5hT9fjtV2O5MBuWxiLm9xarF6rx8nGnjaTWjbm3btWgoWJjtMwj28a3s+EWO9hian43dXf0XV2+oVMDZU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33aeb088324so1539579f8f.2 for ; Tue, 30 Jan 2024 04:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616697; x=1707221497; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=qT4BM4QggUDd/mriRzEn6ZypenFxQPkGzA1q4EIkPuc=; b=EOd50TvqRH19pdWB2FgV3eDcPTXQnU9iLSUfLG/lJWmMt4L1rSBHT6sqcVTmasylDc jsYYB0AkWQ1Ti6QxfHqeQiI2ceIwmEq9qC35BEEASuFErpqriUNeRtcHHYjYqxnbB8u1 +LPCaSGIbz7alc6cPPV77xsCh44LAKmNNJg7EKDFARCQuHn58PRMPio/2ebzqN8BBQCm ZFinDPqHkhSdLDggsuTSjLARK4U9knoZ1SjhPJteom6WmfOpEBZzN7pIKvbypJVnUeVG avi3tytqroyd0pI3rpE6iul6SCvH9L5/Q1oXJOBiIOnqX2iQ+e9H7QT3jQNn+2K7kND9 +7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616697; x=1707221497; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qT4BM4QggUDd/mriRzEn6ZypenFxQPkGzA1q4EIkPuc=; b=CAyrJcWzah6Cfvw2xSkNA8IPtu5jKwjvaNqkSvttDmXB9h2Of6CcECNSWoAuPHn9aK F9/y1eog78BxgsG7V6cRrK7yzosedJ6t9RgcF6XeqW/e/d75DYEmP+Szq/kuDriYxcvA 0wFLmMnRwPlWDqqfNao86HfRHyY0q1edG7Nzmf0JXN0n2Hb16hH3gUmtnkSyJGWMCe/s 9xsLka0TeKJevfdahgB7+y/yHGI61/wlX7Xy7N21pL1xhNd/FpNvk05WXAzoPTgehX/g RxMr5N4V4wadfIT7FshySWu8/gBjfmM4UBPuie+7brEjaCinBpVVaaz7y9/veVfijjHI /ipQ== X-Gm-Message-State: AOJu0YwqZOUjhxORS1N8gAgVyj3ZOI4Mljb+tW0/UcrprYx7QJXvlb+6 RBJosXkJ3R7igDHciLOTQY7vemW7wbt2JoKU62iRwmwCY9EhoykVeKE68I5Aig== X-Google-Smtp-Source: AGHT+IGDLxQ+FPvj9MDFPSxtt1PMrDtkJGDSrdpEhWFgiz+uljF7Byx9xSCTtbMpImxBfMG+iSwKZQ== X-Received: by 2002:a5d:60ca:0:b0:337:c93d:d815 with SMTP id x10-20020a5d60ca000000b00337c93dd815mr5382324wrt.35.1706616697071; Tue, 30 Jan 2024 04:11:37 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id f9-20020a056000036900b00339307d9d31sm10569894wrf.112.2024.01.30.04.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:11:36 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Pierre-Emmanuel Patry Subject: [COMMITTED 064/101] gccrs: Add a regression test for function body check Date: Tue, 30 Jan 2024 13:07:20 +0100 Message-ID: <20240130121026.807464-67-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240130121026.807464-2-arthur.cohen@embecosm.com> References: <20240130121026.807464-2-arthur.cohen@embecosm.com> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.2 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Pierre-Emmanuel Patry Function body check emit an error message when a required function body is missing. gcc/testsuite/ChangeLog: * rust/compile/functions_without_body.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- .../rust/compile/functions_without_body.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/rust/compile/functions_without_body.rs diff --git a/gcc/testsuite/rust/compile/functions_without_body.rs b/gcc/testsuite/rust/compile/functions_without_body.rs new file mode 100644 index 00000000000..36ddea52161 --- /dev/null +++ b/gcc/testsuite/rust/compile/functions_without_body.rs @@ -0,0 +1,21 @@ +struct MyStruct; + +trait X {} + +fn test_a(); +// { dg-error "free function without a body" "" { target *-*-* } .-1 } + +impl MyStruct { + fn test_b() + // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 } + where + T: Copy; + + fn test_c(); + // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 } +} + +impl X for MyStruct { + fn test_d(); + // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 } +} -- 2.42.1