From patchwork Wed Feb 7 11:43:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1896135 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=NyOc6OV2; 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 4TVKjG0J4Hz23gT for ; Wed, 7 Feb 2024 23:50:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 091D43857C65 for ; Wed, 7 Feb 2024 12:50:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 23DC93858028 for ; Wed, 7 Feb 2024 12:44:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23DC93858028 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 23DC93858028 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707309860; cv=none; b=GFJmD+5Jzon2bK6uwIPnqFMVNXtNoudQaXP5FEYh2mK0b6NEdurGOizEZCy3Ynb563BR4GaHwriulh/6fNZDyGVMKwCtFIcT6yE/qtbXBQklzNEHtkV6fkGL4QbkKcwi5qFpYf9Y05tlCX/DwCzvAUOWxE5h8kpmmeIf9idQjOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707309860; c=relaxed/simple; bh=ZTBIyaGtzv76Evl/R1+h6ExxctgarFOyqdXYYSjSijM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bA/7OA4sQMx6nIqBOpmC+S+2duKIv5TH5+bDs2nAG/1sUNbVulAb5EGHWR9lPPWOxU5L2MdxVVkOnQw9x6324zQ4eCACVvL3mzOV93uBnz7TIjDgBzPz+sM1cuvdcJaJvS5+f1GWf4NWoTDavqYAXvidlU5KPOs+47oE8pZFvQo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40fc6343bd2so4867645e9.1 for ; Wed, 07 Feb 2024 04:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1707309849; x=1707914649; 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=w4ZJ5TAyupWZDdna310NCKc1jMfHe6CunIGXb7jkSgM=; b=NyOc6OV2oce4y1x9FMolX0YCRYB2xLTa3D1R05hvxqsWzovwtBqKAPyErg0crUzmGa csjzBJlmliH5KssM/y/qIOVImFUPJQU4BvFEJxR5E0YftSXR8tJPiaJngaLjeh/CAerb SaucUbXNO9+yHZYSioUgsaVjUnmFsuAjsWI+1VGxIlfMA/0L8LWenMV1x/GzIkl+hZg/ Rjlgd+IQjJaqDYWn6ns0qlrfCnSXAt4BxxaTPUc85PTeKM/LoYymn9fwzMb5jlNI7+e1 y7KNm+vd/UwxrFrG7duUHmfoyi/m/KjPe2shjNQZhaZrBHcdLgR7XHUJZFr6aaKWO228 NR3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707309849; x=1707914649; 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=w4ZJ5TAyupWZDdna310NCKc1jMfHe6CunIGXb7jkSgM=; b=D1glaBTmvvsRjvxubWmWg6LxMUrb1yPcw8U5gFL+pGKrZhaDKNSSBaxpcOK8G6cmI+ aCxQSOhC2PxZk0t0QxqhDFapmvs/2HfuJsekzPPMwvInhdP+JlbcUfrMwkETcsVEQ+pH MwcQEPJA8FYOHpsjG0OO1GLcwaYWcpK8kNhatyuHSrEUHsDcqGKpUW8sSlP12EafGMJI qn0CB2iqFVUFUJPfy6XSXakphYyXKEZJ32aMaa59I/kVukQmKzifgv8iVKPqLwtqqATP Ua2Hx6ArQrhVM1t3jgSuwmLN5FSmqrGLyZJ+D+McpDlhw6cGNY9ukheck5lyVUVI/cgn B7rg== X-Gm-Message-State: AOJu0YyODdKvIpoUijU6S9T3rjTjHg0IrX+aK+EG0Nht0YTkz+wZrgBl gVnLf1GV80XrUNIcUWK15TTi7/48M09Ve8Jewb+5JFzMG1nbi3PgIdBqjJy1I/Oyg3Pz08hG+Cq OeQ== X-Google-Smtp-Source: AGHT+IFx7udd/FAXjNF/NMHuGto2BNHUPK8ZwHzbhmduQ4z1dku1oHQxBWAd+CEpl6r6u65c1CBlqg== X-Received: by 2002:adf:e643:0:b0:33b:1c1e:3e5f with SMTP id b3-20020adfe643000000b0033b1c1e3e5fmr3942745wrn.16.1707309849452; Wed, 07 Feb 2024 04:44:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU9YYGvrUx4SJfvgs1HoSXiR7ZnJAtsWPY5WErEtBeEuHcILeHs0jEu3WnHNDFVFD2QDkF6qchNUCf+A6PbJdnGy6JC49TjmXiFUPub Received: from platypus.sou.embecosm-corp.com ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id x19-20020a05600c2a5300b0040fbdd6f69bsm5044188wme.33.2024.02.07.04.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 04:44:08 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [COMMITTED 10/25] gccrs: add testcase to prove issue has already been fixed Date: Wed, 7 Feb 2024 12:43:56 +0100 Message-ID: <20240207114419.1100894-11-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240207114419.1100894-2-arthur.cohen@embecosm.com> References: <20240207114419.1100894-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 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: Philip Herron Fixes #1483 gcc/testsuite/ChangeLog: * rust/compile/issue-1483.rs: New test. --- gcc/testsuite/rust/compile/issue-1483.rs | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-1483.rs diff --git a/gcc/testsuite/rust/compile/issue-1483.rs b/gcc/testsuite/rust/compile/issue-1483.rs new file mode 100644 index 00000000000..eda7e139283 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1483.rs @@ -0,0 +1,28 @@ +#[lang = "sized"] +pub trait Sized {} + +#[lang = "fn_once"] +pub trait FnOnce { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +pub fn takes_fn_generic i32>(a: i32, f: F) -> i32 { + f(a) +} + +pub fn takes_fn_generic_where(a: i32, f: F) -> i32 +where + F: FnOnce(i32) -> i32, +{ + f(a) +} + +pub fn test() { + let foo = |x: i32| -> i32 { x + 1 }; + + takes_fn_generic(1, foo); + takes_fn_generic_where(2, foo); +}