From patchwork Tue Jan 30 12:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1892911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=XRIZ1bST; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TPQ2P0zrkz23fD for ; Tue, 30 Jan 2024 23:48:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 246C13864C64 for ; Tue, 30 Jan 2024 12:48:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id A9BD738582BF for ; Tue, 30 Jan 2024 12:12:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9BD738582BF 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 A9BD738582BF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616778; cv=none; b=Os9Wz6z41qVcYQP7wTkbjSuprxeYeppdsYC6SFf74SZCqwvJfz24K0lEhguD3ay+ltw/X9OS33+3xHtyXvoD7CfWSruinWUBCN/BCgO9a2sJRkXEry90JBagswRbAPHpbtBmxOvZy7kYJuv9h4ejw74smxsYshVNpu9gMGXuaB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616778; c=relaxed/simple; bh=vGuZogYQZprs3muuw9lexLSUA+ED5TsRF59EvwE6Uic=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BjreEoWCvOAK+vZTxGtWLCCJDsVoNq96XatN4ORy/3Ipi0s2sPIlQm9PjLc6n47zZz1WiqyYtcXmchxJVSn/qmNYsPtujyTbgXAJ7YB/WPyvyTHs6rnXNXW1V/edAPTKydboMTdyomnOPCv/kt3xmZwb0IG1qRbkhJveYF/SIlw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40fafd3ebb5so1119905e9.2 for ; Tue, 30 Jan 2024 04:12:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616719; x=1707221519; 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=Fr6NPO8uw0iG/mBx4SWdamYfDF+YFH1P+EvCx8X3wH4=; b=XRIZ1bSTJ669Am1AE/kYeX4pRL1i3plgmJmMMIVi9OI11o8u6fcgI/UOzYYWmtRQJD PRsLWW+K2uz4dvjntyEsIyGwaED3N6JELfXJK4s6KcDbTYWaKHqSuI8iVuguudrFdTtN umRPr5VQo6Yw7a24URLDyoJhYpJElATFdOqf2h4b9rVleU3uIjQdsORZxZ0WWPfAXn/D 2Z2bVVZdVXll67l66j4uj+dJSBTcRpdh1rCbcRScMLs1NySpmpSLxDWSoxnZ/wYPvnPE aOCo8NuHnyainFga4YMrGcTonofvVRzsgDzb8wpOLpwnxLLUUScEyq2M4G/y6M/JfsQn 7A4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616719; x=1707221519; 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=Fr6NPO8uw0iG/mBx4SWdamYfDF+YFH1P+EvCx8X3wH4=; b=VEZdH4TIwYwjauBZXRa0dEjiB5OcS4W/U0T/HYH0w9m4q7dPJUYKT+p0xHlNjd1Zro oOaCkS+YEb/X29TD5WGtipyEUO7i7axcLFswXKsmfF/EcyvPkLR4bnz7voBEItij63Em O3ayKyMl1nl1nNvIxD4wF+4YclQ+W3ZW6U5LbIYZwZoF+8CLGyhvovl9qPcwu/HXVgHQ ephXlbsZLbEDJXMVMh2bl2cvdjPrAMRcB8JsSlEct/Kg5JGQpfce6s2xrPKPDCOTQuTr UrpBHRk1BQsG2f34dR9j7Y4ttvFSQXq/6chJQbqWXANU305ncfx72hP/LxwuXHo+IN8s IM6g== X-Gm-Message-State: AOJu0Yy4pI7wdKdZE40yOSr2Pomw5KFO732jQ4E0nhyHK0uZTFjbP2VQ fiOLy6vtqE0Z1DouyIBGdLuSbyia4D6/4nf/cwSDcB17hR4zgD26IJX/wCUlFn54OUDjvC80S0w ZKQ== X-Google-Smtp-Source: AGHT+IE5S2DXcp5Shst/RsMJRznyb5/bpEEzV0XzMU74pQIZnlc82UfaCS5sUVUUB+n/yWXDK42BUQ== X-Received: by 2002:adf:f982:0:b0:33a:fe6a:482 with SMTP id f2-20020adff982000000b0033afe6a0482mr119280wrr.32.1706616718902; Tue, 30 Jan 2024 04:11:58 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:11:58 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Jakub Dupak Subject: [COMMITTED 098/101] gccrs: Test: check implemented for lifetime handling Date: Tue, 30 Jan 2024 13:07:54 +0100 Message-ID: <20240130121026.807464-101-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> MIME-Version: 1.0 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=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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Jakub Dupak gcc/testsuite/ChangeLog: * rust/compile/for_lifetimes.rs: New test. Signed-off-by: Jakub Dupak --- gcc/testsuite/rust/compile/for_lifetimes.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/rust/compile/for_lifetimes.rs diff --git a/gcc/testsuite/rust/compile/for_lifetimes.rs b/gcc/testsuite/rust/compile/for_lifetimes.rs new file mode 100644 index 00000000000..26469624298 --- /dev/null +++ b/gcc/testsuite/rust/compile/for_lifetimes.rs @@ -0,0 +1,19 @@ +// { dg-additional-options "-frust-compile-until=typecheck" } + +fn function_pointer_as_argument(f: for<'a> fn(&'a i32) -> &'a i32) -> i32 { + 0 +} + +fn function_pointer_as_return() -> for<'a> fn(&'a i32) -> &'a i32 { +} + +// https://doc.rust-lang.org/reference/trait-bounds.html + +trait Fn {} +fn call_on_ref_zero(f: F) where for<'a> F: Fn(&'a i32) {} + +fn call_on_ref_zero2(f: F) where F: for<'a> Fn(&'a i32) {} + +trait Trait<'a, T: 'a> {} + +impl<'a, T> Trait<'a, T> for &'a T {} \ No newline at end of file