public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] gccrs: Clear the substitution callbacks when copying ArgumentMappings
@ 2023-02-07 17:55 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-02-07 17:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fc6c5f7dc2062d222a99157fb514d71ad87b1b45

commit fc6c5f7dc2062d222a99157fb514d71ad87b1b45
Author: Philip Herron <herron.philip@googlemail.com>
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 <herron.philip@googlemail.com>
    
    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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-07 17:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 17:55 [gcc/devel/rust/master] gccrs: Clear the substitution callbacks when copying ArgumentMappings Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).