Skip to content

Commit 82301b7

Browse files
committed
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 <pierre-emmanuel.patry@embecosm.com>
1 parent 6f99437 commit 82301b7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

gcc/rust/typecheck/rust-hir-trait-resolve.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,10 @@ TraitResolver::resolve_trait (HIR::Trait *trait_reference)
253253

254254
// They also inherit themselves as a bound this enables a trait item to
255255
// reference other Self::trait_items
256-
auto self_hrtb
257-
= TyTy::TypeBoundPredicate (trait_reference->get_mappings ().get_defid (),
258-
std::move (self_subst_copy),
259-
BoundPolarity::RegularBound,
260-
trait_reference->get_locus ());
261-
specified_bounds.push_back (self_hrtb);
256+
specified_bounds.emplace_back (trait_reference->get_mappings ().get_defid (),
257+
std::move (self_subst_copy),
258+
BoundPolarity::RegularBound,
259+
trait_reference->get_locus ());
262260

263261
// look for any
264262
std::vector<TyTy::TypeBoundPredicate> super_traits;

0 commit comments

Comments
 (0)