diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-11-24 15:15:40 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-11-24 15:15:40 +0000 |
commit | 4924160c275d8fafab2dbd4257fb7473fbac5ceb (patch) | |
tree | 1f4ab48341cf5625175a40576142d6f3a10119db | |
parent | 717b6da459b26ace9a3c303cfa5e485ff8935709 (diff) | |
download | gcc-4924160c275d8fafab2dbd4257fb7473fbac5ceb.zip gcc-4924160c275d8fafab2dbd4257fb7473fbac5ceb.tar.gz gcc-4924160c275d8fafab2dbd4257fb7473fbac5ceb.tar.bz2 |
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.
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-implitem.h | 6 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-item.h | 2 |
2 files changed, 4 insertions, 4 deletions
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; |