aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-01-27 18:31:11 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:21 +0200
commit2f228578d56dd9a13111bd6a22df808b5da205e3 (patch)
tree682af01734217312bbbc38366405c54f8e015945
parentdcb2e571ac6a142ce80bc5e1956008eae232cd12 (diff)
downloadgcc-2f228578d56dd9a13111bd6a22df808b5da205e3.zip
gcc-2f228578d56dd9a13111bd6a22df808b5da205e3.tar.gz
gcc-2f228578d56dd9a13111bd6a22df808b5da205e3.tar.bz2
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
-rw-r--r--gcc/rust/typecheck/rust-tyty-subst.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc
index a5d7387..0e181ef 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;