From: Arthur Cohen <arthur.co...@embecosm.com> gcc/rust/ChangeLog:
* ast/rust-ast.h (reconstruct_vec): Pre-allocate size of vector. --- gcc/rust/ast/rust-ast.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index ecbc2918130..0d853e744c7 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -107,6 +107,7 @@ std::vector<std::unique_ptr<T>> reconstruct_vec (const std::vector<std::unique_ptr<T>> &to_reconstruct) { std::vector<std::unique_ptr<T>> reconstructed; + reconstructed.reserve (to_reconstruct.size ()); for (const auto &elt : to_reconstruct) reconstructed.emplace_back (std::unique_ptr<T> (elt->reconstruct_impl ())); -- 2.49.0