From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id E30753858025 for ; Wed, 7 Feb 2024 12:44:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E30753858025 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 E30753858025 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 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-x335.google.com with SMTP id 5b1f17b1804b1-4100826df08so4826835e9.2 for ; Wed, 07 Feb 2024 04:44:10 -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=A0BTzE0+RjdCWzTVpkBy6mH2EnKvmYySs3j9XxbUtnJKEjRC6xVXCJdMJhuBTVcFgn GrW3QE74VG7Da1hxyX9yDPDq/xUybqOXsus7jig2VYNE7N/D0oZeLIjW6KSMixU+6beu BmQPcBf1d794Mtodk+qFr6UAqGe8m164C9NAz1vV4re8s2Sdv4GeSnscPLzf8gMMPYdQ Qnderfx8sjFRHKVe4b5/XrSAVrfsXK/D9dpdl9Jv/Ogb4R4ZbgKHiWgCkTBOnkmltKrz hNsb9EgMxpyeuCdj/plyrt28yNt++aP+c+OHOCaUKeRkrzp3nKTdUjag5OwdPE9K3I3G 0BPQ== X-Gm-Message-State: AOJu0Yzn07FfCckczC9kNGR5BhTYxRfT46WEPQNsBititsRjXkAu8k5y o84e1qYA/9QMEUR0jbzfFpy2+vBoOVAqIwAL0kC3OUFfUxsJ5nMqR479Lc4e+EskxUelZWUR2CE 9nw== 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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=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: 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); +} -- 2.42.1