about summary refs log tree commit diff
path: root/src/librustc_allocator
diff options
context:
space:
mode:
authorIgor Gutorov <igootorov@gmail.com>2018-08-13 22:15:16 +0300
committerIgor Gutorov <igootorov@gmail.com>2018-08-23 10:45:53 +0300
commit4d81fe9243cc8372d3ad5a0eec3dd638578a3541 (patch)
treef392a7f8c84c5c771588d993675ecb07338739db /src/librustc_allocator
parente73077e10603b3586828f2d3d067f804c2fc0a1f (diff)
downloadrust-4d81fe9243cc8372d3ad5a0eec3dd638578a3541.tar.gz
rust-4d81fe9243cc8372d3ad5a0eec3dd638578a3541.zip
Use optimized SmallVec implementation
Diffstat (limited to 'src/librustc_allocator')
-rw-r--r--src/librustc_allocator/Cargo.toml1
-rw-r--r--src/librustc_allocator/expand.rs6
-rw-r--r--src/librustc_allocator/lib.rs2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml
index 83a918f2af8..cd3ef6a1f04 100644
--- a/src/librustc_allocator/Cargo.toml
+++ b/src/librustc_allocator/Cargo.toml
@@ -16,3 +16,4 @@ rustc_target = { path = "../librustc_target" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
 log = "0.4"
+smallvec = { version = "0.6.5", features = ["union"] }
diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs
index da60f41ee68..5999416cecf 100644
--- a/src/librustc_allocator/expand.rs
+++ b/src/librustc_allocator/expand.rs
@@ -78,20 +78,20 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> {
             _ => {
                 self.handler
                     .span_err(item.span, "allocators must be statics");
-                return OneVector::one(item);
+                return smallvec![item];
             }
         }
 
         if self.in_submod > 0 {
             self.handler
                 .span_err(item.span, "`global_allocator` cannot be used in submodules");
-            return OneVector::one(item);
+            return smallvec![item];
         }
 
         if self.found {
             self.handler
                 .span_err(item.span, "cannot define more than one #[global_allocator]");
-            return OneVector::one(item);
+            return smallvec![item];
         }
         self.found = true;
 
diff --git a/src/librustc_allocator/lib.rs b/src/librustc_allocator/lib.rs
index d020fe96335..2a3404ee830 100644
--- a/src/librustc_allocator/lib.rs
+++ b/src/librustc_allocator/lib.rs
@@ -18,6 +18,8 @@ extern crate rustc_errors;
 extern crate rustc_target;
 extern crate syntax;
 extern crate syntax_pos;
+#[macro_use]
+extern crate smallvec;
 
 pub mod expand;