diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 26c061258cd2..467bf1c21753 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -597,7 +597,7 @@ BaseType::monomorphized_clone () const { std::vector cloned_params; for (auto &p : fn->get_params ()) - cloned_params.push_back (p.clone ()); + cloned_params.push_back (p.monomorphized_clone ()); BaseType *retty = fn->get_return_type ()->monomorphized_clone (); return new FnType (fn->get_ref (), fn->get_ty_ref (), fn->get_id (), diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index c896d1e03b75..167d425840e6 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -791,6 +791,11 @@ class FnParam void set_type (BaseType *new_type) { type = new_type; } FnParam clone () const + { + return FnParam (pattern->clone_pattern (), type->clone ()); + } + + FnParam monomorphized_clone () const { return FnParam (pattern->clone_pattern (), type->monomorphized_clone ()); }