From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id F3B85385840F; Tue, 7 Feb 2023 17:55:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3B85385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675792556; bh=YgCFwiUligbyNXm76SM0OKD07IBXCC/ADgoZAG9nPl0=; h=From:To:Subject:Date:From; b=Ex8wuVUS2Cno1FRrEpI9snUbfLa7ydHg1LQw53JihEGpngTW/gQh6PvsGoVZZvenw 1UMzvxkkQQlW283DK9Kkeo0mhw5g7eRdtjerT7Zlba9gULh84mjbIUbIv0lFK1xKqR 5Hu3w7Y3TT/uzd/f8NDZGBgKe8maMCaNdiTuhgBc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] gccrs: Clear the substitution callbacks when copying ArgumentMappings X-Act-Checkin: gcc X-Git-Author: Philip Herron X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 50856ddba4689710dd53865e96cc7da9885b7b51 X-Git-Newrev: fc6c5f7dc2062d222a99157fb514d71ad87b1b45 Message-Id: <20230207175555.F3B85385840F@sourceware.org> Date: Tue, 7 Feb 2023 17:55:55 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fc6c5f7dc2062d222a99157fb514d71ad87b1b45 commit fc6c5f7dc2062d222a99157fb514d71ad87b1b45 Author: Philip Herron Date: Fri Jan 27 18:31:11 2023 +0000 gccrs: Clear the substitution callbacks when copying ArgumentMappings 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 Diff: --- 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;