From 1c4521b39702ffae7d737479926cd5e1ab34c564 Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Mon, 26 May 2025 11:31:40 +0200 Subject: [PATCH] gccrs: reconstruct_vec: Allocate size when creating the vector 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> 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 ())); -- 2.47.2