From patchwork Wed Apr 5 14:03:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp356651vqo; Wed, 5 Apr 2023 07:37:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Zq/HY0P23+hbVLEsfUhtsF4wHp4aQEmTbRb39t5rVmES/9ejDR51ojQal/2pf2oxgAeRi2 X-Received: by 2002:a17:906:368d:b0:8b1:7ead:7d43 with SMTP id a13-20020a170906368d00b008b17ead7d43mr2735294ejc.50.1680705464414; Wed, 05 Apr 2023 07:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680705464; cv=none; d=google.com; s=arc-20160816; b=uE5JHZsyVWc+9deRxgNwn3AFPxc/B5Eyj7aLsvM2zqF4c0nIXBF+cp5KrDSLebzmza qbNDpYGMMEbEexSYxZvTEFchG4RyMtDvFgODhY1bmtFM41IFj+W2wkqLwD87otDwHOH+ mO180Kg9yrGeiNAykXxkSMELbaqiXE78JXHMo4tm7o8PcdXkyA0Pcg5ccx/8xb+O+ebC lHyw7sVFHklPsOG+XNVm8cuni4/VZZns1EsfVyG74aotRsF05KCpvxNW3kehwkUK7xAc OTTTEkkw6rOVZELkXPrO8KfHFI1bUk/RrfagR2Bk2KPL3ek4ojxv86Sv3hWl9/QeKf1O Noew== 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=n74sdHS4RZyf/z/uHtJkJ4OHdmNcbh3i7u3F9PddgvI=; b=yk385Hc4TokMfgfYXupZVlj64b8uat6dIs8u30EurwoCt3ZkUQjrZlnDntqwFyFY02 3W0p5YBK4rxVXdP7FXhtVST/mPLbFTQOjRmYY8r9T1qv61xkJzwIreVCDHLhqIaohrNy ujqaxaD88dX5uYUUJcH8p2pSwGcsYMyFVWYaXn7w+wAtx0QoPTmb9TCZCmgAAz7FtgZa oKDeDl/sHL2B9c5ePXki/Ud9pfxowNE682qYYEGl83GhnY3UKpfx+Mm3yp3euNd4dCfb sioFWJpBhk5g587KalXrLAidJZDRSg6qzDJUNFzF2j/MycKk/+QZ7TED1f9edUextL/A GHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=OxZYSnVU; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l19-20020a170906645300b00946a18bb2dfsi12898437ejn.986.2023.04.05.07.37.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:37:44 -0700 (PDT) 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=OxZYSnVU; 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 0513238CBDA6 for ; Wed, 5 Apr 2023 14:14:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 831AD3854173 for ; Wed, 5 Apr 2023 14:06:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 831AD3854173 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-x331.google.com with SMTP id n10-20020a05600c4f8a00b003ee93d2c914so23482595wmq.2 for ; Wed, 05 Apr 2023 07:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703562; 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=n74sdHS4RZyf/z/uHtJkJ4OHdmNcbh3i7u3F9PddgvI=; b=OxZYSnVU7+I0z89DcsrOHDvXZ9WZQlgaj1LF9hfm4nfoYx0Jkd4l1bw7cGzAAV4yjt DIB6i0NFp2qtTipTyb2Z6RiKWMWhZ/6t2OmKo8/Uy1glSwV0VIucDIGRfSOfCmKOgbGz b59G3x7oQO3xi4/8XFtkm9sCSOJAF7lYqx7edXb6Z/kBJz90yNBY//iOkr0RLuRWnk4O JjLtZjIVfR15IhkzTyN1ZESKTjfVbXladoG8b/3AtxYf2WNu3AGAYNuDWCL881uDkpo7 iZLiSZrkoWPJ9X/jrdfEd+1QrmnA5GAAnM5mzKCVXTCv7O+je74O1Boyc5eLCn0OUXcE rRGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703562; 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=n74sdHS4RZyf/z/uHtJkJ4OHdmNcbh3i7u3F9PddgvI=; b=VW/6Q7F9eB8Uk2PG5W86siIdmb/1cLX3qNjJoIbVI+lM7pjatlp5v/+jBZXZzEPIsm GSFjDv3ZMy0KkQGORFOjNaPEj0XfGFwCCT6pBrboXsOemeXFPNksBUL0UnJI9PD/zm5E UvfL/QIoRrM+f+3c5dp+9xf7scMJ8+Z5KPjQGYGobBadrDajI1xNHw+Ce6Bclu+7efGb 7btCYyk30yG5kWaWsRp/Y7EKdzxKQcAUg4NComZkNgx4OpHG4vpB5RMlKm9K9ij1FaFg FLcY2SYLQ2RXYwVhpj9cZ8eGZ3UsxY/Ga8+4nP4inMAqE0/TpoGGw5DPp0lQtETZIX7j u/UQ== X-Gm-Message-State: AAQBX9eVRn1Kllzoujo/tMBO3RVHyavmajENTyAliOHJpXvXynPlB57o 6wA50ENBgLOofCVHWEmhxatj255anneq1B9YQg== X-Received: by 2002:a1c:4c09:0:b0:3ee:289a:3c3a with SMTP id z9-20020a1c4c09000000b003ee289a3c3amr4998761wmf.30.1680703561750; Wed, 05 Apr 2023 07:06:01 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:06:01 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [committed 47/88] gccrs: Clear the substitution callbacks when copying ArgumentMappings Date: Wed, 5 Apr 2023 16:03:31 +0200 Message-Id: <20230405140411.3016563-48-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=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 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?1762347413261228730?= X-GMAIL-MSGID: =?utf-8?q?1762347413261228730?= From: Philip Herron When we set the callback on substitutions this is not safe to be copied around since we store the used argument mappings and can reuse them in different contexts. This clears the callback on copy's to make it safer. Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc: update copy constructors --- gcc/rust/typecheck/rust-tyty-subst.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc index a5d738744fc..0e181efb359 100644 --- a/gcc/rust/typecheck/rust-tyty-subst.cc +++ b/gcc/rust/typecheck/rust-tyty-subst.cc @@ -241,7 +241,7 @@ SubstitutionArgumentMappings::SubstitutionArgumentMappings ( SubstitutionArgumentMappings::SubstitutionArgumentMappings ( const SubstitutionArgumentMappings &other) : mappings (other.mappings), binding_args (other.binding_args), - locus (other.locus), param_subst_cb (other.param_subst_cb), + locus (other.locus), param_subst_cb (nullptr), trait_item_flag (other.trait_item_flag) {} @@ -252,7 +252,7 @@ SubstitutionArgumentMappings::operator= ( mappings = other.mappings; binding_args = other.binding_args; locus = other.locus; - param_subst_cb = other.param_subst_cb; + param_subst_cb = nullptr; trait_item_flag = other.trait_item_flag; return *this;