diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2021-04-21 21:40:29 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2021-04-21 22:39:08 -0700 |
| commit | e8eb691c1fccc84cf8cf2194b20f0cefafa10fa1 (patch) | |
| tree | 97d719bab82b78b88e06f5be5419f4aed8b1928b /compiler/rustc_data_structures | |
| parent | b849326744a8eec939e592f0ab13bff85cc865d3 (diff) | |
| download | rust-e8eb691c1fccc84cf8cf2194b20f0cefafa10fa1.tar.gz rust-e8eb691c1fccc84cf8cf2194b20f0cefafa10fa1.zip | |
Use arrayvec 0.7, drop smallvec 0.6
With the arrival of min const generics, many alt-vec libraries have updated to use it in some way and arrayvec is no exception. Use the latest with minor refactoring. Also, rustc_workspace_hack is the only user of smallvec 0.6 in the entire tree, so drop it.
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/Cargo.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/sso/map.rs | 13 |
2 files changed, 6 insertions, 9 deletions
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index d32598e716e..d0a5fe1f2a6 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" doctest = false [dependencies] -arrayvec = { version = "0.5.1", default-features = false } +arrayvec = { version = "0.7", default-features = false } ena = "0.14" indexmap = "1.5.1" tracing = "0.1" diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs index 06e8442d475..e249886e9bc 100644 --- a/compiler/rustc_data_structures/src/sso/map.rs +++ b/compiler/rustc_data_structures/src/sso/map.rs @@ -18,11 +18,8 @@ use std::ops::Index; // for reasonably small arrays that stay // small in vast majority of cases. // -// '8' is choosen as a sane default, to be +// '8' is chosen as a sane default, to be // reevaluated later. -// -// Note: As of now ArrayVec design prevents -// us from making it user-customizable. const SSO_ARRAY_SIZE: usize = 8; /// Small-storage-optimized implementation of a map. @@ -70,7 +67,7 @@ const SSO_ARRAY_SIZE: usize = 8; #[derive(Clone)] pub enum SsoHashMap<K, V> { - Array(ArrayVec<[(K, V); SSO_ARRAY_SIZE]>), + Array(ArrayVec<(K, V), SSO_ARRAY_SIZE>), Map(FxHashMap<K, V>), } @@ -411,7 +408,7 @@ where impl<K, V> IntoIterator for SsoHashMap<K, V> { type IntoIter = EitherIter< - <ArrayVec<[(K, V); 8]> as IntoIterator>::IntoIter, + <ArrayVec<(K, V), 8> as IntoIterator>::IntoIter, <FxHashMap<K, V> as IntoIterator>::IntoIter, >; type Item = <Self::IntoIter as Iterator>::Item; @@ -441,7 +438,7 @@ fn adapt_array_mut_it<K, V>(pair: &'a mut (K, V)) -> (&'a K, &'a mut V) { impl<'a, K, V> IntoIterator for &'a SsoHashMap<K, V> { type IntoIter = EitherIter< std::iter::Map< - <&'a ArrayVec<[(K, V); 8]> as IntoIterator>::IntoIter, + <&'a ArrayVec<(K, V), 8> as IntoIterator>::IntoIter, fn(&'a (K, V)) -> (&'a K, &'a V), >, <&'a FxHashMap<K, V> as IntoIterator>::IntoIter, @@ -459,7 +456,7 @@ impl<'a, K, V> IntoIterator for &'a SsoHashMap<K, V> { impl<'a, K, V> IntoIterator for &'a mut SsoHashMap<K, V> { type IntoIter = EitherIter< std::iter::Map< - <&'a mut ArrayVec<[(K, V); 8]> as IntoIterator>::IntoIter, + <&'a mut ArrayVec<(K, V), 8> as IntoIterator>::IntoIter, fn(&'a mut (K, V)) -> (&'a K, &'a mut V), >, <&'a mut FxHashMap<K, V> as IntoIterator>::IntoIter, |
