about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-14 07:39:15 -0700
committerGitHub <noreply@github.com>2020-07-14 07:39:15 -0700
commit99c0b9764a6da35fdcb0bb08beaa18f7a3e0224a (patch)
tree858a3d8ab0d765f67e41c6e1552d6f5f2486f081 /src
parente8703e88fc79929bb9e96e3ac3e1720bfe0c456c (diff)
parentc492ca40a288d8a85353ba112c4d38fe87ef453e (diff)
downloadrust-99c0b9764a6da35fdcb0bb08beaa18f7a3e0224a.tar.gz
rust-99c0b9764a6da35fdcb0bb08beaa18f7a3e0224a.zip
Rollup merge of #74310 - nnethercote:use-ArrayVec-in-SparseBitSet, r=eddyb
Use `ArrayVec` in `SparseBitSet`.

Instead of `SmallVec`, because the maximum size is known.

r? @eddyb
Diffstat (limited to 'src')
-rw-r--r--src/librustc_index/Cargo.toml2
-rw-r--r--src/librustc_index/bit_set.rs11
2 files changed, 6 insertions, 7 deletions
diff --git a/src/librustc_index/Cargo.toml b/src/librustc_index/Cargo.toml
index f0422b1af1b..00b23760182 100644
--- a/src/librustc_index/Cargo.toml
+++ b/src/librustc_index/Cargo.toml
@@ -11,4 +11,4 @@ doctest = false
 
 [dependencies]
 rustc_serialize = { path = "../librustc_serialize" }
-smallvec = { version = "1.0", features = ["union", "may_dangle"] }
+arrayvec = "0.5.1"
diff --git a/src/librustc_index/bit_set.rs b/src/librustc_index/bit_set.rs
index cb8b30830c5..3e1d4b68c6f 100644
--- a/src/librustc_index/bit_set.rs
+++ b/src/librustc_index/bit_set.rs
@@ -1,5 +1,5 @@
 use crate::vec::{Idx, IndexVec};
-use smallvec::SmallVec;
+use arrayvec::ArrayVec;
 use std::fmt;
 use std::iter;
 use std::marker::PhantomData;
@@ -355,20 +355,19 @@ where
 const SPARSE_MAX: usize = 8;
 
 /// A fixed-size bitset type with a sparse representation and a maximum of
-/// `SPARSE_MAX` elements. The elements are stored as a sorted `SmallVec` with
-/// no duplicates; although `SmallVec` can spill its elements to the heap, that
-/// never happens within this type because of the `SPARSE_MAX` limit.
+/// `SPARSE_MAX` elements. The elements are stored as a sorted `ArrayVec` with
+/// no duplicates.
 ///
 /// This type is used by `HybridBitSet`; do not use directly.
 #[derive(Clone, Debug)]
 pub struct SparseBitSet<T: Idx> {
     domain_size: usize,
-    elems: SmallVec<[T; SPARSE_MAX]>,
+    elems: ArrayVec<[T; SPARSE_MAX]>,
 }
 
 impl<T: Idx> SparseBitSet<T> {
     fn new_empty(domain_size: usize) -> Self {
-        SparseBitSet { domain_size, elems: SmallVec::new() }
+        SparseBitSet { domain_size, elems: ArrayVec::new() }
     }
 
     fn len(&self) -> usize {