From: Pierre-Emmanuel Patry Date: Thu, 21 Aug 2025 10:59:19 +0000 (+0200) Subject: gccrs: Avoid copy when constructing TypeBoundPredicate X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1e3e3ec02342fb0b26295df7d20569c27c9a94e;p=thirdparty%2Fgcc.git gccrs: Avoid copy when constructing TypeBoundPredicate Construct the TypeBoundPredicate in the vector instead of copying it. gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Construct value in place. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc index b8dd0ad782a..03121d1009e 100644 --- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc +++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc @@ -253,12 +253,10 @@ TraitResolver::resolve_trait (HIR::Trait *trait_reference) // They also inherit themselves as a bound this enables a trait item to // reference other Self::trait_items - auto self_hrtb - = TyTy::TypeBoundPredicate (trait_reference->get_mappings ().get_defid (), - std::move (self_subst_copy), - BoundPolarity::RegularBound, - trait_reference->get_locus ()); - specified_bounds.push_back (self_hrtb); + specified_bounds.emplace_back (trait_reference->get_mappings ().get_defid (), + std::move (self_subst_copy), + BoundPolarity::RegularBound, + trait_reference->get_locus ()); // look for any std::vector super_traits;