about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorDániel Buga <bugadani@gmail.com>2020-12-20 23:55:03 +0100
committerDániel Buga <bugadani@gmail.com>2020-12-20 23:55:03 +0100
commit6d71cc675091e2ca1080dc46ddaf3d202dd2c949 (patch)
treee88882aeae44a4e56d3b51279e7dd13c87349e10 /compiler/rustc_resolve/src
parent66c28729016301da78f294aaff15d29567d9d02c (diff)
downloadrust-6d71cc675091e2ca1080dc46ddaf3d202dd2c949.tar.gz
rust-6d71cc675091e2ca1080dc46ddaf3d202dd2c949.zip
Move std_path construction into condition
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/late.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 2775ed51c51..b13462587bc 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -1891,12 +1891,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                     self.r.trait_map.insert(id, traits);
                 }
 
-                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) {
+                    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 let PathResult::Module(_) | PathResult::NonModule(_) =
                         self.resolve_path(&std_path, Some(ns), false, span, CrateLint::No)
                     {