about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDániel Buga <bugadani@gmail.com>2020-12-20 21:38:41 +0100
committerDániel Buga <bugadani@gmail.com>2020-12-20 21:38:41 +0100
commit62f593bda9eff51efdbc3172c3ee768cb3528b1f (patch)
treee4178a64e2857305e4db68b1ec4ad370560073f2
parent93d5a8025dd53469c0ea80b645a3087a1d87bb57 (diff)
downloadrust-62f593bda9eff51efdbc3172c3ee768cb3528b1f.tar.gz
rust-62f593bda9eff51efdbc3172c3ee768cb3528b1f.zip
Precompute vector length in smart_resolve_path_fragment
-rw-r--r--compiler/rustc_resolve/src/late.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 02a7bc0b622..4beaf6bfa80 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -1891,8 +1891,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                     self.r.trait_map.insert(id, traits);
                 }
 
-                let mut std_path = vec![Segment::from_ident(Ident::with_dummy_span(sym::std))];
+                let mut std_path = Vec::with_capacity(1 + path.len());
 
+                std_path.push(Segment::from_ident(Ident::with_dummy_span(sym::std)));
                 std_path.extend(path);
 
                 if self.r.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {