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:
Jubilee Young 2021-04-21 21:40:29 -07:00
parent b849326744
commit e8eb691c1f
8 changed files with 61 additions and 69 deletions

View file

@ -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" }

View file

@ -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()
};

View file

@ -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'] }