From patchwork Wed Apr 5 14:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp348049vqo; Wed, 5 Apr 2023 07:25:33 -0700 (PDT) X-Google-Smtp-Source: AKy350awTDqIRuxL1gBuoHKAaLzztOkjdQ713sAbw3vVeoUEwVJfS/KHknGhjEdJiqfHqUA595FJ X-Received: by 2002:a17:906:4910:b0:931:2f49:c040 with SMTP id b16-20020a170906491000b009312f49c040mr3299278ejq.51.1680704733126; Wed, 05 Apr 2023 07:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680704733; cv=none; d=google.com; s=arc-20160816; b=xfkHK20HrySW7OAdu1lg00T/yA8jdlAfYfkvEy8tkwsbpzZHdFkI6UVBrTtLvrHl2w IJyAY+VWQWok2CrLCb2nFzCmwHj2LLAm8e2V1VjMmesfVOx5nJiV/hL0Y1+WXTN/aA4u zh9Hi8WHzi4oFiqIna2ZpsO3SwwUNLhRulux8eekdEKhvGGQ1tLgYE7CohrGjYRi2u3s rg9PYhVCCrxlpy/765CHIjqaIyu67Afn2/32Q5fWgprZlnx6FNnja8mZ/caEEN8fTfI0 9vmavt31CIAzZdq8F6kbpUz+maNV5uCEki1mpgVZKhDi4eXOMwuGtuZJzBc42MgWYphM VE7g== 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=7M/j+prtAdg5/Ga2UZA8D2V2bN2jQPO2st4o1MLsKTQ=; b=xggUAw9O3WyDhjkyMubUrqIc7GioGB0iehIeaC+L9qqWh5E2fsHPYI+zSYGIJLwCa1 1Y+IvKJ4/wLDWt/Zl9RAvC036rsPo/TPOBngVKvvc9qL6DMTpw+AOJ1NTqWsIOAOiZU5 IXyQuA2h+cxvyYIiGSrqMDVZYUSnwpBm08Va1pcMRJvYYSbbY+6IsgSJVsNIGSHpUpkL U/XqlJdzNVFbUHRursYZnL/nBQlImgha0jo6anPVrenp4qZUKfrOvw4s8oQ8pH/+d9cz YvDb4nHpGT4vAeAsqtL0bkgLWnHfWjxs3nqPHdaw7Iy6+vgfxMPiBzu7/wHEVT4fviGe 4hNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=Pvse7NMu; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e26-20020a056402089a00b00501d7ce6144si3572810edy.474.2023.04.05.07.25.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:25:33 -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=Pvse7NMu; 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 C47173ACBC9A for ; Wed, 5 Apr 2023 14:11:16 +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 98BB1385703E for ; Wed, 5 Apr 2023 14:05:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 98BB1385703E 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-x334.google.com with SMTP id s13so20939458wmr.4 for ; Wed, 05 Apr 2023 07:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703548; 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=7M/j+prtAdg5/Ga2UZA8D2V2bN2jQPO2st4o1MLsKTQ=; b=Pvse7NMuD7OAooWWgNTaMEj6iyC1EdGIzbADKr+56hCMr1u+9VB/wYgimk6iu8aszr 29KfvzL4071HnYJQJGAyzpldOlA1n2liCxInGZoImN3enOyXKvLZd4KSfI5OI+DWa/j2 S5utlNMuNPXT1I4pHh+DNI/qc7/5VZ+0MHxjp+4LDcUh4DN/P2Nqq/8k4hwkumy7Ej8P a11JNjdFFJPOq+Incd/20h13xlXBZlzBZp2w2EdDC3YyzIgWRUCm2hg9SR6LYLtIqD7a lzU9RE9P44z+HM4CEpaeE5Lx5tpo9P/H4jZxBYCTAKSwF5qTEh8Swi2rG7HdVWL2CcB4 Y8XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703548; 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=7M/j+prtAdg5/Ga2UZA8D2V2bN2jQPO2st4o1MLsKTQ=; b=csuaL4Ws+HQFRlotnFlQnOIZv11ToolyjxV6kINx0GiluzJzXdpuiVF2yiAbl3oGop p3o7TgCKpEOGGWjg66sQzsKoAeyBOU3XPoQZ9GsiYyPVHAiMtCOLkubOM9McudvNXdcD 0AxKiMwgi2we5FLUdMwbRKgQbmUqxg8UeRLOuuiy6UtrWHMGTd2rWZMw91sHOiWSi675 64ntITZmv98dJxjx0RXfVdrjAXACBaAHAKV5ldgFpSLBgTO2pjuljJLql1ujr4bUanzf qQW62VPlSKFji8zjzKiro5obHDbhmjnCbEE1U50C2x5lJYzFt3e+7iEMRciUQf5CHA+E SiYw== X-Gm-Message-State: AAQBX9dYWiNh2m60QnX7WNLxYwCK4QfORaS3w7P+g4+Z1avmUItX4XzD f0OV/Wo3Ji8hCfLa3hyhmJb4vx1zS5nlvus6lA== X-Received: by 2002:a7b:ca54:0:b0:3f0:3c2:3fa4 with SMTP id m20-20020a7bca54000000b003f003c23fa4mr4878729wml.12.1680703548052; Wed, 05 Apr 2023 07:05:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:05:47 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Owen Avery Subject: [committed 28/88] gccrs: Remove HIR::GroupedPattern Date: Wed, 5 Apr 2023 16:03:12 +0200 Message-Id: <20230405140411.3016563-29-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 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=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.29 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762346645790134968?= X-GMAIL-MSGID: =?utf-8?q?1762346645790134968?= From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-fnparam.h (CompileFnParam::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.h (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. (CompilePatternLet::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-resolve-path.h (ResolvePathRef::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-var-decl.h (CompileVarDecl::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.h (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.cc (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.h (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/tree/rust-hir-full-decls.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-full-test.cc (GroupedPattern::accept_vis): Remove method. * hir/tree/rust-hir-pattern.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Remove HIR::GroupedPattern visitor. (HIRFullVisitorBase::visit): Remove HIR::GroupedPattern visitor. (HIRPatternVisitor::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.h (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-compile-fnparam.h | 1 - gcc/rust/backend/rust-compile-pattern.cc | 12 ---- gcc/rust/backend/rust-compile-pattern.h | 8 --- gcc/rust/backend/rust-compile-resolve-path.h | 1 - gcc/rust/backend/rust-compile-var-decl.h | 1 - gcc/rust/checks/errors/rust-const-checker.cc | 4 -- gcc/rust/checks/errors/rust-const-checker.h | 1 - gcc/rust/checks/errors/rust-unsafe-checker.cc | 4 -- gcc/rust/checks/errors/rust-unsafe-checker.h | 1 - gcc/rust/hir/rust-hir-dump.cc | 3 - gcc/rust/hir/rust-hir-dump.h | 1 - gcc/rust/hir/tree/rust-hir-full-decls.h | 1 - gcc/rust/hir/tree/rust-hir-full-test.cc | 12 ---- gcc/rust/hir/tree/rust-hir-pattern.h | 69 ------------------- gcc/rust/hir/tree/rust-hir-visitor.h | 3 - .../typecheck/rust-hir-type-check-pattern.cc | 9 --- .../typecheck/rust-hir-type-check-pattern.h | 1 - 17 files changed, 132 deletions(-) diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h index 0d99814a6b3..10e8b67c140 100644 --- a/gcc/rust/backend/rust-compile-fnparam.h +++ b/gcc/rust/backend/rust-compile-fnparam.h @@ -39,7 +39,6 @@ public: void visit (HIR::TupleStructPattern &) override; // Empty visit for unused Pattern HIR nodes. - void visit (HIR::GroupedPattern &) override {} void visit (HIR::LiteralPattern &) override {} void visit (HIR::PathInExpression &) override {} void visit (HIR::QualifiedPathInExpression &) override {} diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc index e13d6caf7e6..bad98be44d0 100644 --- a/gcc/rust/backend/rust-compile-pattern.cc +++ b/gcc/rust/backend/rust-compile-pattern.cc @@ -161,12 +161,6 @@ CompilePatternCaseLabelExpr::visit (HIR::RangePattern &pattern) case_label_expr = build_case_label (lower, upper, associated_case_label); } -void -CompilePatternCaseLabelExpr::visit (HIR::GroupedPattern &pattern) -{ - pattern.get_item ()->accept_vis (*this); -} - // setup the bindings void @@ -335,12 +329,6 @@ CompilePatternBindings::visit (HIR::StructPattern &pattern) } } -void -CompilePatternBindings::visit (HIR::GroupedPattern &pattern) -{ - pattern.get_item ()->accept_vis (*this); -} - void CompilePatternLet::visit (HIR::IdentifierPattern &pattern) { diff --git a/gcc/rust/backend/rust-compile-pattern.h b/gcc/rust/backend/rust-compile-pattern.h index 317a3451161..ddf5b14265e 100644 --- a/gcc/rust/backend/rust-compile-pattern.h +++ b/gcc/rust/backend/rust-compile-pattern.h @@ -38,7 +38,6 @@ public: void visit (HIR::TupleStructPattern &pattern) override; void visit (HIR::WildcardPattern &pattern) override; void visit (HIR::RangePattern &pattern) override; - void visit (HIR::GroupedPattern &pattern) override; // Empty visit for unused Pattern HIR nodes. void visit (HIR::IdentifierPattern &) override {} @@ -70,7 +69,6 @@ public: void visit (HIR::StructPattern &pattern) override; void visit (HIR::TupleStructPattern &pattern) override; - void visit (HIR::GroupedPattern &) override; // Empty visit for unused Pattern HIR nodes. void visit (HIR::IdentifierPattern &) override {} @@ -105,12 +103,6 @@ public: void visit (HIR::WildcardPattern &) override; // check for unimplemented Pattern HIR nodes. - void visit (HIR::GroupedPattern &pattern) override - { - rust_sorry_at (pattern.get_locus (), - "grouped pattern let statements not supported"); - } - void visit (HIR::LiteralPattern &pattern) override { rust_sorry_at (pattern.get_locus (), diff --git a/gcc/rust/backend/rust-compile-resolve-path.h b/gcc/rust/backend/rust-compile-resolve-path.h index 67ff7eed2d5..6aec7be472f 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.h +++ b/gcc/rust/backend/rust-compile-resolve-path.h @@ -45,7 +45,6 @@ public: void visit (HIR::QualifiedPathInExpression &expr) override; // Empty visit for unused Pattern HIR nodes. - void visit (HIR::GroupedPattern &) override {} void visit (HIR::IdentifierPattern &) override {} void visit (HIR::LiteralPattern &) override {} void visit (HIR::RangePattern &) override {} diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index 791ee9c1112..9e07999f273 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -69,7 +69,6 @@ public: } // Empty visit for unused Pattern HIR nodes. - void visit (HIR::GroupedPattern &) override {} void visit (HIR::LiteralPattern &) override {} void visit (HIR::PathInExpression &) override {} void visit (HIR::QualifiedPathInExpression &) override {} diff --git a/gcc/rust/checks/errors/rust-const-checker.cc b/gcc/rust/checks/errors/rust-const-checker.cc index 7e31c9f9c28..3752cf36716 100644 --- a/gcc/rust/checks/errors/rust-const-checker.cc +++ b/gcc/rust/checks/errors/rust-const-checker.cc @@ -834,10 +834,6 @@ void ConstChecker::visit (TuplePattern &) {} -void -ConstChecker::visit (GroupedPattern &) -{} - void ConstChecker::visit (SlicePattern &) {} diff --git a/gcc/rust/checks/errors/rust-const-checker.h b/gcc/rust/checks/errors/rust-const-checker.h index 238173874aa..e0402361367 100644 --- a/gcc/rust/checks/errors/rust-const-checker.h +++ b/gcc/rust/checks/errors/rust-const-checker.h @@ -186,7 +186,6 @@ private: virtual void visit (TuplePatternItemsMultiple &tuple_items) override; virtual void visit (TuplePatternItemsRanged &tuple_items) override; virtual void visit (TuplePattern &pattern) override; - virtual void visit (GroupedPattern &pattern) override; virtual void visit (SlicePattern &pattern) override; virtual void visit (EmptyStmt &stmt) override; virtual void visit (LetStmt &stmt) override; diff --git a/gcc/rust/checks/errors/rust-unsafe-checker.cc b/gcc/rust/checks/errors/rust-unsafe-checker.cc index 3c369a2a81a..ff7a0b3f85a 100644 --- a/gcc/rust/checks/errors/rust-unsafe-checker.cc +++ b/gcc/rust/checks/errors/rust-unsafe-checker.cc @@ -901,10 +901,6 @@ void UnsafeChecker::visit (TuplePattern &) {} -void -UnsafeChecker::visit (GroupedPattern &) -{} - void UnsafeChecker::visit (SlicePattern &) {} diff --git a/gcc/rust/checks/errors/rust-unsafe-checker.h b/gcc/rust/checks/errors/rust-unsafe-checker.h index 2abd3a62351..ce270c0e7ef 100644 --- a/gcc/rust/checks/errors/rust-unsafe-checker.h +++ b/gcc/rust/checks/errors/rust-unsafe-checker.h @@ -168,7 +168,6 @@ private: virtual void visit (TuplePatternItemsMultiple &tuple_items) override; virtual void visit (TuplePatternItemsRanged &tuple_items) override; virtual void visit (TuplePattern &pattern) override; - virtual void visit (GroupedPattern &pattern) override; virtual void visit (SlicePattern &pattern) override; virtual void visit (EmptyStmt &stmt) override; virtual void visit (LetStmt &stmt) override; diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index 875e1dd9374..10720c43294 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -457,9 +457,6 @@ void Dump::visit (TuplePattern &) {} void -Dump::visit (GroupedPattern &) -{} -void Dump::visit (SlicePattern &) {} diff --git a/gcc/rust/hir/rust-hir-dump.h b/gcc/rust/hir/rust-hir-dump.h index 8715a95ada8..b66e6b13f7c 100644 --- a/gcc/rust/hir/rust-hir-dump.h +++ b/gcc/rust/hir/rust-hir-dump.h @@ -163,7 +163,6 @@ private: virtual void visit (TuplePatternItemsMultiple &) override; virtual void visit (TuplePatternItemsRanged &) override; virtual void visit (TuplePattern &) override; - virtual void visit (GroupedPattern &) override; virtual void visit (SlicePattern &) override; virtual void visit (EmptyStmt &) override; diff --git a/gcc/rust/hir/tree/rust-hir-full-decls.h b/gcc/rust/hir/tree/rust-hir-full-decls.h index 7870a5497ed..30adda6a1f3 100644 --- a/gcc/rust/hir/tree/rust-hir-full-decls.h +++ b/gcc/rust/hir/tree/rust-hir-full-decls.h @@ -206,7 +206,6 @@ class TuplePatternItems; class TuplePatternItemsMultiple; class TuplePatternItemsRanged; class TuplePattern; -class GroupedPattern; class SlicePattern; // rust-type.h diff --git a/gcc/rust/hir/tree/rust-hir-full-test.cc b/gcc/rust/hir/tree/rust-hir-full-test.cc index 230b7f72a85..b6646d61b28 100644 --- a/gcc/rust/hir/tree/rust-hir-full-test.cc +++ b/gcc/rust/hir/tree/rust-hir-full-test.cc @@ -4476,12 +4476,6 @@ TuplePattern::accept_vis (HIRFullVisitor &vis) vis.visit (*this); } -void -GroupedPattern::accept_vis (HIRFullVisitor &vis) -{ - vis.visit (*this); -} - void SlicePattern::accept_vis (HIRFullVisitor &vis) { @@ -4608,12 +4602,6 @@ EmptyStmt::accept_vis (HIRStmtVisitor &vis) vis.visit (*this); } -void -GroupedPattern::accept_vis (HIRPatternVisitor &vis) -{ - vis.visit (*this); -} - void WildcardPattern::accept_vis (HIRPatternVisitor &vis) { diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h index b7a230c526f..5243d7898c0 100644 --- a/gcc/rust/hir/tree/rust-hir-pattern.h +++ b/gcc/rust/hir/tree/rust-hir-pattern.h @@ -1215,75 +1215,6 @@ protected: } }; -// HIR node representing a pattern in parentheses, used to control precedence -class GroupedPattern : public Pattern -{ - std::unique_ptr pattern_in_parens; - Location locus; - Analysis::NodeMapping mappings; - -public: - std::string as_string () const override - { - return "(" + pattern_in_parens->as_string () + ")"; - } - - GroupedPattern (Analysis::NodeMapping mappings, - std::unique_ptr pattern_in_parens, Location locus) - : pattern_in_parens (std::move (pattern_in_parens)), locus (locus), - mappings (mappings) - {} - - // Copy constructor uses clone - GroupedPattern (GroupedPattern const &other) - : pattern_in_parens (other.pattern_in_parens->clone_pattern ()), - locus (other.locus), mappings (other.mappings) - {} - - // Overload assignment operator to clone - GroupedPattern &operator= (GroupedPattern const &other) - { - pattern_in_parens = other.pattern_in_parens->clone_pattern (); - locus = other.locus; - mappings = other.mappings; - - return *this; - } - - // default move semantics - GroupedPattern (GroupedPattern &&other) = default; - GroupedPattern &operator= (GroupedPattern &&other) = default; - - Location get_locus () const override { return locus; } - - void accept_vis (HIRFullVisitor &vis) override; - void accept_vis (HIRPatternVisitor &vis) override; - - Analysis::NodeMapping get_pattern_mappings () const override final - { - return mappings; - } - - PatternType get_pattern_type () const override final - { - return PatternType::GROUPED; - } - - std::unique_ptr &get_item () { return pattern_in_parens; } - const std::unique_ptr &get_item () const - { - return pattern_in_parens; - } - -protected: - /* Use covariance to implement clone function as returning this object rather - * than base */ - GroupedPattern *clone_pattern_impl () const override - { - return new GroupedPattern (*this); - } -}; - // HIR node representing patterns that can match slices and arrays class SlicePattern : public Pattern { diff --git a/gcc/rust/hir/tree/rust-hir-visitor.h b/gcc/rust/hir/tree/rust-hir-visitor.h index ba6cad7614b..a635f9079f1 100644 --- a/gcc/rust/hir/tree/rust-hir-visitor.h +++ b/gcc/rust/hir/tree/rust-hir-visitor.h @@ -138,7 +138,6 @@ public: virtual void visit (TuplePatternItemsMultiple &tuple_items) = 0; virtual void visit (TuplePatternItemsRanged &tuple_items) = 0; virtual void visit (TuplePattern &pattern) = 0; - virtual void visit (GroupedPattern &pattern) = 0; virtual void visit (SlicePattern &pattern) = 0; virtual void visit (EmptyStmt &stmt) = 0; virtual void visit (LetStmt &stmt) = 0; @@ -290,7 +289,6 @@ public: virtual void visit (TuplePatternItemsMultiple &) override {} virtual void visit (TuplePatternItemsRanged &) override {} virtual void visit (TuplePattern &) override {} - virtual void visit (GroupedPattern &) override {} virtual void visit (SlicePattern &) override {} virtual void visit (EmptyStmt &) override {} @@ -470,7 +468,6 @@ public: class HIRPatternVisitor { public: - virtual void visit (GroupedPattern &) = 0; virtual void visit (IdentifierPattern &) = 0; virtual void visit (LiteralPattern &) = 0; virtual void visit (PathInExpression &) = 0; diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc index 393f4158003..fd4814c3604 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc @@ -386,15 +386,6 @@ TypeCheckPattern::visit (HIR::IdentifierPattern &) infered = parent; } -void -TypeCheckPattern::visit (HIR::GroupedPattern &pattern) -{ - TyTy::BaseType *inner_ty - = TypeCheckPattern::Resolve (pattern.get_item ().get (), parent); - infered = inner_ty->clone (); - infered->set_ref (pattern.get_pattern_mappings ().get_hirid ()); -} - void TypeCheckPattern::visit (HIR::QualifiedPathInExpression &) { diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.h b/gcc/rust/typecheck/rust-hir-type-check-pattern.h index bdfc90723e9..e7550071548 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-pattern.h +++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.h @@ -39,7 +39,6 @@ public: void visit (HIR::LiteralPattern &pattern) override; void visit (HIR::RangePattern &pattern) override; void visit (HIR::IdentifierPattern &pattern) override; - void visit (HIR::GroupedPattern &pattern) override; void visit (HIR::QualifiedPathInExpression &pattern) override; void visit (HIR::ReferencePattern &pattern) override; void visit (HIR::SlicePattern &pattern) override;