From: Arthur Cohen Date: Mon, 26 May 2025 09:31:40 +0000 (+0200) Subject: gccrs: reconstruct_vec: Allocate size when creating the vector X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c4521b39702ffae7d737479926cd5e1ab34c564;p=thirdparty%2Fgcc.git gccrs: reconstruct_vec: Allocate size when creating the vector gcc/rust/ChangeLog: * ast/rust-ast.h (reconstruct_vec): Pre-allocate size of vector. --- 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> reconstruct_vec (const std::vector> &to_reconstruct) { std::vector> reconstructed; + reconstructed.reserve (to_reconstruct.size ()); for (const auto &elt : to_reconstruct) reconstructed.emplace_back (std::unique_ptr (elt->reconstruct_impl ()));