Message ID | 20240221131636.3336103-5-arthur.cohen@embecosm.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1028396dyc; Wed, 21 Feb 2024 05:17:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrmXqac266zcltojK9g44xcldIZYoiVXtRrIfjqUi9jtUBrlNsMTtUeWGrnKpoBDHhfd8RzJtasWh7bAopvoJuCEhbwQ== X-Google-Smtp-Source: AGHT+IEzYM3UZkJAoayOvsn++Dgo2uKBdLj+n+Izkn3dv2owhdMBJz0G9SfPUghY6IPjrtJEe2Tl X-Received: by 2002:a25:361c:0:b0:dcc:7ad6:24df with SMTP id d28-20020a25361c000000b00dcc7ad624dfmr18341960yba.17.1708521477644; Wed, 21 Feb 2024 05:17:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708521477; cv=pass; d=google.com; s=arc-20160816; b=GPir6tPHGeADuBsISdMoahFI7c4iLWmTwaxwqVk9tmVdNym8QeC0XIKMR5YqiLWpRa ak0j4jfiFDlUUMJEHCfcwtP9GIuBnjFWxKc+x7oXhMciHdaKDwcmWYPFhFTWZfLb9PmL QezWhgv8OxwoHGtTypbkuZHizvtu1VU1EQL1bs2VGopHHxidCWQbUejc88OH+MRzeQrX 9bjS7F95ktmdO8zwu+AU9Q9YU4IHuxW3SPhNkwzlktBglBfmOLmejPB4NmzqyRjXn/+q 8mI7YLpDBwQhmliKowjTjLKQeobId5+BBVOVY3PQXpCEKaHAykjhCLBsgsN8Nj5M9i5S zYbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=+lNsr/IjYOhc+WYnNBAR/sGPIZkyi8Lf9bIKaNT3X0E=; fh=6KiXNvQww/MsyVplklPLl//mUuD+DtDm73nSHh4O4+g=; b=mjcmUGB5Zl11XoAuWRrzPX/D0onuztpCdw0Ht+Pa22A09rGns4p1uK6wh7ewL2a+Ae z9NA33nLmTyhvrdbUAtnlgdHW45YpjNhXwYg7olxrLUzsZrUvAvz8aSljbWxoM5QTvf+ 23b7dJ6/dwl3C7c2zD2fhfa8M0vVSANvVoJ26nYK+NbCEuNsIFgk7+U/YNH7oNZCdGZR sjZ3z+0zWyJ6H9WUM5hFZvAUkF88YtYA9Xjaw6FPN0l8hGMwdTSzZLAu6p9NUSb4vw79 qooEue/hS6u8K3vn9ROmEH8rIT5M8/zhjZXxP7UWlqSMSFBe8Gps7/AwBhs8dO1K/wKv yD6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=XOTCKKDp; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e11-20020ac845cb000000b0042c78775ef1si10036135qto.277.2024.02.21.05.17.57 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:17:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=XOTCKKDp; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A0A3385829A for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 13:17:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 9677F3858D34 for <gcc-patches@gcc.gnu.org>; Wed, 21 Feb 2024 13:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9677F3858D34 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 9677F3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708521387; cv=none; b=DMnioxjnvlo2g2Ond3/wb5re13U6PDGcScRt3kr+Z7/H5hRaf1c5+aA7BESGQ1ww6BAdCBiii6//1QSKRYMaBEQuR3q4yXcYyqF/i85ns8RWdlqr9J0xhXpNw+a/AnL+Qf5Cj0dH/+l6gUuw/dQBV9pG/tmqqzoeNsjkDbeMNDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708521387; c=relaxed/simple; bh=wGjKw3hQWpDUD4JryA7gkQiexF2FR45qVH+csVA+xts=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=P++ik0WjhXXalpldGpfv+GGgTH1L3sGvNw9QHb0KFCDhnIvtHA6/knaLT0glzgxKJyeSWW8X5oWdbMZ+74smBrR4EgSfJV7IJrNUipxwn5bgP00TSC2bW3cG1/3wAvhIgBDZLUvQFBCa8vFigQ/SJBhuyS8itcRJAggFcmAxgFA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a3f5808b0dfso48380366b.1 for <gcc-patches@gcc.gnu.org>; Wed, 21 Feb 2024 05:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1708521383; x=1709126183; 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=+lNsr/IjYOhc+WYnNBAR/sGPIZkyi8Lf9bIKaNT3X0E=; b=XOTCKKDpf9szpQuPzobwUx90bRF/cWhTuIJ1+kiqyrZVjjnzY6sWzN4H2lE5ynQxhf LXfnbf76hgrKJqCek6FrW6QbvCWkoEEMszrt0yzW5DkXCPnVJ2yIyB9MyhnHnWxio83Y HPXOkpyJYtz+qVyjrinKArY++Wi/YZQb6wlN64+BN7kOTbHcQ5ObOOweqkv/j2a3k6Ak 6Xw2iEo+hjOhV4AHHZ+S8vW5JkzM8xPbJbzc2q+BmhS2NVUeaQrnzFlPYK7v4fPpomUZ +RAtDg8eDT7tVV2OcPwr05VokObea2A5SRXd411aOm1zytpE+7IgDsJ4aYhfyMT3RnOH cz1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708521383; x=1709126183; 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=+lNsr/IjYOhc+WYnNBAR/sGPIZkyi8Lf9bIKaNT3X0E=; b=VJlifIoEj3iptAJVAUOnRcdqa8iJygDbwZTpeWBMJ5g12OoFutD3ARNLL/DgIAyo68 sk3WcNb10730ehFyPi1VVCF7l+WYD+dcxR09OGNRIDmdf0r8QX3BICxMquQ3AckFpXfa iAiXnIKPjNGirWejWajlNOYfuzCt2TybzLh9dJBKM/QOSYbMAubKtOFXLf9RsTPdsi/i p/AA2HToGOmphDpFcoIA6U8irDlHXnYrI65m0OpQtNy6jKUBhB33x3Z9atRKq1Kywz1p K/3Ypuv/yh0Z5uPmf5zZtJoik4ljPEXsk05BRLHjaKDB8+cdeo52YfY9mb0ZVMo4kKcX Zzzg== X-Gm-Message-State: AOJu0YzF/Ylv88NltGJP+GX46Orm6FiCf+FFKsOu9VTWo0RXo6jV2Tgx ztpUuD7JSo2kdsQtvy5y6Bblx5llONI+7Ml7dxOxWvaiVnQtHyB1/GbNi5X2H/hw+7lP94RqTT0 = X-Received: by 2002:a17:906:b35a:b0:a3f:2756:957d with SMTP id cd26-20020a170906b35a00b00a3f2756957dmr1741903ejb.7.1708521383655; Wed, 21 Feb 2024 05:16:23 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id m12-20020a170906160c00b00a3d0a094574sm4927074ejd.66.2024.02.21.05.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:16:23 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com> Subject: [COMMITTED 2/9] gccrs: Add testcase for matches!() macro Date: Wed, 21 Feb 2024 14:15:20 +0100 Message-ID: <20240221131636.3336103-5-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240221131636.3336103-2-arthur.cohen@embecosm.com> References: <20240221131636.3336103-2-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=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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791514616871803976 X-GMAIL-MSGID: 1791514616871803976 |
Series |
[COMMITTED,1/9] gccrs: Fix typo in RegionConstraints instance
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Arthur Cohen
Feb. 21, 2024, 1:15 p.m. UTC
From: Arthur Cohen <arthur.cohen@embecosm.com>
This adds a testcase for issue #2129.
gcc/testsuite/ChangeLog:
* rust/execute/torture/matches_macro.rs: New test.
---
.../rust/execute/torture/matches_macro.rs | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 gcc/testsuite/rust/execute/torture/matches_macro.rs
diff --git a/gcc/testsuite/rust/execute/torture/matches_macro.rs b/gcc/testsuite/rust/execute/torture/matches_macro.rs new file mode 100644 index 00000000000..7b61570727d --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/matches_macro.rs @@ -0,0 +1,30 @@ +macro_rules! matches { + ($expression:expr, $($pattern:pat)|+ $( if $guard:expr ),*) => { + match $expression { + $($pattern)|+ => true, + _ => false, + } + } +} + +pub fn should_match() -> bool { + matches!(1, 1) +} + +pub fn shouldnt() -> bool { + matches!(1, 2) +} + +fn main() -> i32 { + let mut retval = 2; + + if should_match() { + retval -= 1; + } + + if !shouldnt() { + retval -= 1; + } + + retval +}