Message ID | 20230405140411.3016563-5-arthur.cohen@embecosm.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp336513vqo; Wed, 5 Apr 2023 07:10:30 -0700 (PDT) X-Google-Smtp-Source: AKy350bI/GxSybCYBUXYAV04qDoU48G9/cQ1qooas6iHs2/4WsICCvirlVsia7IwWdIuDfXFepd+ X-Received: by 2002:aa7:d859:0:b0:4fa:aee8:235f with SMTP id f25-20020aa7d859000000b004faaee8235fmr1864236eds.9.1680703830244; Wed, 05 Apr 2023 07:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680703830; cv=none; d=google.com; s=arc-20160816; b=SLrnPlWQymDiCNob1MKIY5akgIrhB/JJsd9vd2VhaUinoTihbv3NZUVFe6NqZwFVn2 jB5GS1+BWaRUE3BuZqe6Ztyv9AHXjumz0MCGAEQafRS7IAP4SF6b4RlGO1tLlW1YV6vk lpb+t69OJaGq04mJefscI4ZIA0kMSu3AmeBdnTwBaH4bguOtRcX34D24gu+SmoEtWwqU x4IpKdc+iyBDI62TO0mpBQNzEv1Z4O/NpamoWmCdAHjnvdPCOJoV8PMVt69Hfx4aQ5Mu /5J2vtChfJcp/c8W+wzOH2RQ35I0gu0HkncYAgsimnxIVHsqZm4DZZAB1HgPjDl/KylI S/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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:dmarc-filter :delivered-to; bh=7jGqIhnCvLCExBSHTdhRQCiCVGfsMOwDCWAqMZ4yqAc=; b=CEURQ93riOfKAp5dJrtPRDkFlCNk3zV8bpmVMJvzRvImu6nyvt9BJR3UvjkekjGOFV cbByESRy99QPoL9H7PGXfYKNcGzBHSUyxlWsSAj6pNo94SOn+DSZoKn/9AHHddpWXKgu AvdVQeMk2IFDSTkPc3AZ5ER47wAqg19Ae0CrvK7aGQ2EMdefGArWnxGK87/FyM4yUuT2 x87NWr8xDLHVthib9+oK0WJx4OhCo4ir5AG+4w0NGWw71N+H2R44RaZPOEakKrxRTCcP 18XmFEYAVcos5FuHA6dgp24Jh+MaU8zxuQtNj+i1liASRtzh9axreTP93vG3Ihtj7uS+ s6Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=fMvcHqWI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q10-20020aa7da8a000000b00501df8f316bsi1506137eds.308.2023.04.05.07.10.29 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:10:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=fMvcHqWI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 525EB38A8166 for <ouuuleilei@gmail.com>; Wed, 5 Apr 2023 14:07:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id EB3383856251 for <gcc-patches@gcc.gnu.org>; Wed, 5 Apr 2023 14:05:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB3383856251 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32f.google.com with SMTP id o32so20948765wms.1 for <gcc-patches@gcc.gnu.org>; Wed, 05 Apr 2023 07:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703531; 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=7jGqIhnCvLCExBSHTdhRQCiCVGfsMOwDCWAqMZ4yqAc=; b=fMvcHqWIOkCMLsqizO+3O2Rht2X366y53xtkndaeqfBpRRIDv/XmZfmJDsDBEh+LZt SWf7LlIAWfMp2BXggFMMkl21GFr46ZemSXMuQzP8bmutqqHxkmSIaclMptI6tDtrnwdS byj6DsJkcDZlMLLOgMeEe25V4QpEH2AkSk+MNJYfrM3w8Cw9cPzUQ0lhKZWDD1tKHgky sweOCJxc8ZMAy/99Iv/9YYAQb39rwItOuK65IjiO19iDezD72Bp0U2lMY5RTQC0XpPRz 3K/VayeoL/dFD69pqdBsjj8Br/zYlICsSL4PgzuQTqTdX7al6YeKa+PBNhvT9svZ0TUl zwxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703531; 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=7jGqIhnCvLCExBSHTdhRQCiCVGfsMOwDCWAqMZ4yqAc=; b=6xwuI0NDp7aUgz1X2a3SjWMqmg+jTx6q6QnLAhDTWHPzVpgaeKo9F8M6SXW2oQfeGT QlzmjOO0fSE3SAYzp+CZqD6JeBr+kdcLG0U1DkajpVAMctEG2IMGwwjjXAdUsCart/Ba l+US8+2wluDC6q/ZIAFmpLT6BzZQEYQCZk6t2G+HneiXFS4T4CbWrmPsTLpA/3OeEuW8 pZidNxHF5k+VUHOfTOyKwL18KSWCt3O7HOxORYSdRKyYdFTpMiaNUa7IggVgS8Y1QpIY r/pECcbCmoWgcN/AT2BtjLsviHzyUe9oS/+qBUhLMW5ruZQT+udzevnxY+FY2mtbHMvb XZrg== X-Gm-Message-State: AAQBX9dpY1sgdRqHfxvdI1q6lj/QSGopQX6jfrrq2Ycf72iWkj5Bkdo+ zwZZf7huf9wYjwcbbxVIgeHoGZ+FQG7YZy1cfA== X-Received: by 2002:a05:600c:22d1:b0:3ee:4678:dde with SMTP id 17-20020a05600c22d100b003ee46780ddemr4909219wmg.27.1680703531354; Wed, 05 Apr 2023 07:05:31 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:05:31 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, mxlol233 <mxlol233@outlook.com> Subject: [committed 04/88] gccrs: rust: add bound parsing in parse_generic_arg. Date: Wed, 5 Apr 2023 16:02:48 +0200 Message-Id: <20230405140411.3016563-5-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.6 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 autolearn=ham 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.29 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 Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762345699406579013?= X-GMAIL-MSGID: =?utf-8?q?1762345699406579013?= |
Series |
[committed,01/88] gccrs: fatal_error_flag: Fix typo in error message
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Arthur Cohen
April 5, 2023, 2:02 p.m. UTC
From: mxlol233 <mxlol233@outlook.com> gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_arg): Add proper bound parsing. gcc/testsuite/ChangeLog: * rust/compile/bounds.rs: New test. Signed-off-by: Xiao Ma <mxlol233@outlook.com> --- gcc/rust/parse/rust-parse-impl.h | 17 +++++++++++++++++ gcc/testsuite/rust/compile/bounds.rs | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/rust/compile/bounds.rs
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index cbd40efcc9b..959e0338a10 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -6198,6 +6198,23 @@ Parser<ManagedTokenSource>::parse_generic_arg () else return AST::GenericArg::create_error (); } + else if (next_tok->get_id () == COLON) + { + lexer.skip_token (); // skip ident + lexer.skip_token (); // skip colon + + auto tok = lexer.peek_token (); + std::vector<std::unique_ptr<AST::TypeParamBound>> bounds + = parse_type_param_bounds (); + + auto type = std::unique_ptr<AST::TraitObjectType> ( + new AST::TraitObjectType (std::move (bounds), tok->get_locus (), + false)); + if (type) + return AST::GenericArg::create_type (std::move (type)); + else + return AST::GenericArg::create_error (); + } lexer.skip_token (); return AST::GenericArg::create_ambiguous (tok->get_str (), tok->get_locus ()); diff --git a/gcc/testsuite/rust/compile/bounds.rs b/gcc/testsuite/rust/compile/bounds.rs new file mode 100644 index 00000000000..ecb10d81f65 --- /dev/null +++ b/gcc/testsuite/rust/compile/bounds.rs @@ -0,0 +1,10 @@ +trait Foo { + type Bar; +} + +trait Copy {} + + +fn c<F: Foo<Bar: Foo>>() where F::Bar: Copy { // { dg-warning "function is never used: 'c'" } +} +