mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #84420 - workingjubilee:microvec, r=Mark-Simulacrum
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.
This commit is contained in:
commit
7f4afdf025
100
Cargo.lock
100
Cargo.lock
@ -111,9 +111,15 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
@ -160,7 +166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec",
|
||||
"arrayvec 0.5.2",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
@ -2165,7 +2171,7 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"perf-event-open-sys",
|
||||
"rustc-hash",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2324,7 +2330,7 @@ dependencies = [
|
||||
"rustc-workspace-hack",
|
||||
"rustc_version",
|
||||
"shell-escape",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2548,7 +2554,7 @@ dependencies = [
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall 0.2.5",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
@ -3269,7 +3275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "259cca0e975ecb05fd289ace45280c30ff792efc04e856a7f18b7fc86a3cb610"
|
||||
dependencies = [
|
||||
"rustc-ap-rustc_data_structures",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3285,7 +3291,7 @@ dependencies = [
|
||||
"rustc-ap-rustc_macros",
|
||||
"rustc-ap-rustc_serialize",
|
||||
"rustc-ap-rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3343,7 +3349,7 @@ version = "712.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cbfa7f82517a1b2efe7106c864c3f930b1da8aff07a27fd317af2f36522fd2e"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.5.2",
|
||||
"bitflags",
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
@ -3360,7 +3366,7 @@ dependencies = [
|
||||
"rustc-hash",
|
||||
"rustc-rayon",
|
||||
"rustc-rayon-core",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"stable_deref_trait",
|
||||
"stacker",
|
||||
"tempfile",
|
||||
@ -3408,7 +3414,7 @@ dependencies = [
|
||||
"rustc-ap-rustc_serialize",
|
||||
"rustc-ap-rustc_session",
|
||||
"rustc-ap-rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3440,7 +3446,7 @@ version = "712.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f6f53afc4f7111c82295cb7ea3878f520bbac6a2c5a12e125b4ca9156498cff"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.5.2",
|
||||
"rustc-ap-rustc_macros",
|
||||
"rustc-ap-rustc_serialize",
|
||||
]
|
||||
@ -3496,7 +3502,7 @@ dependencies = [
|
||||
"rustc-ap-rustc_lexer",
|
||||
"rustc-ap-rustc_session",
|
||||
"rustc-ap-rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
"unicode-normalization",
|
||||
]
|
||||
@ -3508,7 +3514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d33c710120953c0214f47a6caf42064d7e241003b4af36c98a6d6156e70335f1"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3657,8 +3663,7 @@ dependencies = [
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"smallvec 0.6.14",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"syn",
|
||||
"url 2.1.1",
|
||||
"winapi 0.3.9",
|
||||
@ -3669,7 +3674,7 @@ name = "rustc_apfloat"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3677,7 +3682,7 @@ name = "rustc_arena"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_data_structures",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3691,7 +3696,7 @@ dependencies = [
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3709,7 +3714,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3772,7 +3777,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3801,7 +3806,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"snap",
|
||||
"tracing",
|
||||
]
|
||||
@ -3840,7 +3845,7 @@ dependencies = [
|
||||
name = "rustc_data_structures"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.7.0",
|
||||
"bitflags",
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
@ -3858,7 +3863,7 @@ dependencies = [
|
||||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"stable_deref_trait",
|
||||
"stacker",
|
||||
"tempfile",
|
||||
@ -3941,7 +3946,7 @@ dependencies = [
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3973,7 +3978,7 @@ dependencies = [
|
||||
"rustc_serialize",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4010,7 +4015,7 @@ dependencies = [
|
||||
name = "rustc_index"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.7.0",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
]
|
||||
@ -4031,7 +4036,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4075,7 +4080,7 @@ dependencies = [
|
||||
"rustc_traits",
|
||||
"rustc_ty_utils",
|
||||
"rustc_typeck",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tempfile",
|
||||
"tracing",
|
||||
"winapi 0.3.9",
|
||||
@ -4164,7 +4169,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"snap",
|
||||
"stable_deref_trait",
|
||||
"tracing",
|
||||
@ -4196,7 +4201,7 @@ dependencies = [
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_type_ir",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4227,7 +4232,7 @@ dependencies = [
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_trait_selection",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4250,7 +4255,7 @@ dependencies = [
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_trait_selection",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4267,7 +4272,7 @@ dependencies = [
|
||||
"rustc_lexer",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
"unicode-normalization",
|
||||
]
|
||||
@ -4368,7 +4373,7 @@ dependencies = [
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4392,7 +4397,7 @@ dependencies = [
|
||||
"rustc_middle",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4421,7 +4426,7 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"rustc_macros",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4518,7 +4523,7 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4538,7 +4543,7 @@ dependencies = [
|
||||
"rustc_middle",
|
||||
"rustc_span",
|
||||
"rustc_trait_selection",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4588,7 +4593,7 @@ dependencies = [
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_trait_selection",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4605,7 +4610,7 @@ dependencies = [
|
||||
name = "rustdoc"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.7.0",
|
||||
"expect-test",
|
||||
"itertools 0.9.0",
|
||||
"minifier",
|
||||
@ -4615,7 +4620,7 @@ dependencies = [
|
||||
"rustdoc-json-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"tempfile",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
@ -4961,15 +4966,6 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0"
|
||||
dependencies = [
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.6.1"
|
||||
@ -5489,7 +5485,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sharded-slab",
|
||||
"smallvec 1.6.1",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -8,6 +8,6 @@ edition = "2018"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
arrayvec = { version = "0.5.1", default-features = false }
|
||||
arrayvec = { version = "0.7", default-features = false }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
|
@ -375,7 +375,7 @@ const SPARSE_MAX: usize = 8;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SparseBitSet<T> {
|
||||
domain_size: usize,
|
||||
elems: ArrayVec<[T; SPARSE_MAX]>,
|
||||
elems: ArrayVec<T, SPARSE_MAX>,
|
||||
}
|
||||
|
||||
impl<T: Idx> SparseBitSet<T> {
|
||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = { version = "0.5.1", default-features = false }
|
||||
arrayvec = { version = "0.7", default-features = false }
|
||||
pulldown-cmark = { version = "0.8", default-features = false }
|
||||
minifier = "0.0.39"
|
||||
rayon = { version = "0.3.0", package = "rustc-rayon" }
|
||||
|
@ -1616,18 +1616,18 @@ impl PrimitiveType {
|
||||
}
|
||||
}
|
||||
|
||||
crate fn impls(&self, tcx: TyCtxt<'_>) -> &'static ArrayVec<[DefId; 4]> {
|
||||
crate fn impls(&self, tcx: TyCtxt<'_>) -> &'static ArrayVec<DefId, 4> {
|
||||
Self::all_impls(tcx).get(self).expect("missing impl for primitive type")
|
||||
}
|
||||
|
||||
crate fn all_impls(tcx: TyCtxt<'_>) -> &'static FxHashMap<PrimitiveType, ArrayVec<[DefId; 4]>> {
|
||||
static CELL: OnceCell<FxHashMap<PrimitiveType, ArrayVec<[DefId; 4]>>> = OnceCell::new();
|
||||
crate fn all_impls(tcx: TyCtxt<'_>) -> &'static FxHashMap<PrimitiveType, ArrayVec<DefId, 4>> {
|
||||
static CELL: OnceCell<FxHashMap<PrimitiveType, ArrayVec<DefId, 4>>> = OnceCell::new();
|
||||
|
||||
CELL.get_or_init(move || {
|
||||
use self::PrimitiveType::*;
|
||||
|
||||
let single = |a: Option<DefId>| a.into_iter().collect();
|
||||
let both = |a: Option<DefId>, b: Option<DefId>| -> ArrayVec<_> {
|
||||
let both = |a: Option<DefId>, b: Option<DefId>| -> ArrayVec<_, 4> {
|
||||
a.into_iter().chain(b).collect()
|
||||
};
|
||||
|
||||
|
@ -71,7 +71,6 @@ proc-macro2 = { version = "1", features = ["default"] }
|
||||
quote = { version = "1", features = ["default"] }
|
||||
serde = { version = "1.0.82", features = ['derive'] }
|
||||
serde_json = { version = "1.0.31", features = ["raw_value", "unbounded_depth"] }
|
||||
smallvec-0_6 = { package = "smallvec", version = "0.6.14", features = ['union', 'may_dangle'] }
|
||||
smallvec = { version = "1.6.1", features = ['union', 'may_dangle'] }
|
||||
syn = { version = "1", features = ['fold', 'full', 'extra-traits', 'visit', 'visit-mut'] }
|
||||
url = { version = "2.0", features = ['serde'] }
|
||||
|
Loading…
Reference in New Issue
Block a user