From 4924160c275d8fafab2dbd4257fb7473fbac5ceb Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Wed, 24 Nov 2021 15:15:40 +0000 Subject: Stop copying HIR::FunctionParams when during lowering Some HIR::TypeNoBounds have a gcc_unreachable() unpon usage of their respective copy constructors this change moves the instances of FunctionParams to avoid the copy. --- gcc/rust/hir/rust-ast-lower-implitem.h | 6 +++--- gcc/rust/hir/rust-ast-lower-item.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/rust-ast-lower-implitem.h b/gcc/rust/hir/rust-ast-lower-implitem.h index 8f9c5d5..3613df5 100644 --- a/gcc/rust/hir/rust-ast-lower-implitem.h +++ b/gcc/rust/hir/rust-ast-lower-implitem.h @@ -153,7 +153,7 @@ public: = HIR::FunctionParam (mapping, std::move (translated_pattern), std::move (translated_type), param.get_locus ()); - function_params.push_back (hir_param); + function_params.push_back (std::move (hir_param)); } bool terminated = false; @@ -239,7 +239,7 @@ public: = HIR::FunctionParam (mapping, std::move (translated_pattern), std::move (translated_type), param.get_locus ()); - function_params.push_back (hir_param); + function_params.push_back (std::move (hir_param)); } bool terminated = false; @@ -345,7 +345,7 @@ public: = HIR::FunctionParam (mapping, std::move (translated_pattern), std::move (translated_type), param.get_locus ()); - function_params.push_back (hir_param); + function_params.push_back (std::move (hir_param)); } HIR::TraitFunctionDecl decl (ref.get_identifier (), std::move (qualifiers), diff --git a/gcc/rust/hir/rust-ast-lower-item.h b/gcc/rust/hir/rust-ast-lower-item.h index 65a4921..697e98a 100644 --- a/gcc/rust/hir/rust-ast-lower-item.h +++ b/gcc/rust/hir/rust-ast-lower-item.h @@ -465,7 +465,7 @@ public: = HIR::FunctionParam (mapping, std::move (translated_pattern), std::move (translated_type), param.get_locus ()); - function_params.push_back (hir_param); + function_params.push_back (std::move (hir_param)); } bool terminated = false; -- cgit v1.1