Skip to content

Commit 8b53ec6

Browse files
committed
Auto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514
rustdoc: Use `ThinVec` in a few places Almost every crate has no primitives and no keywords defined in it, so using `ThinVec` should make some types smaller.
2 parents c051c5d + 3ea8ebc commit 8b53ec6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustdoc/clean/types.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ use std::sync::Arc;
99
use std::{slice, vec};
1010

1111
use arrayvec::ArrayVec;
12+
1213
use rustc_ast::attr;
1314
use rustc_ast::util::comments::beautify_doc_string;
1415
use rustc_ast::{self as ast, AttrStyle};
1516
use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel};
1617
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
18+
use rustc_data_structures::thin_vec::ThinVec;
1719
use rustc_feature::UnstableFeatures;
1820
use rustc_hir as hir;
1921
use rustc_hir::def::{CtorKind, Res};
@@ -54,7 +56,7 @@ crate struct Crate {
5456
crate src: FileName,
5557
crate module: Item,
5658
crate externs: Vec<(CrateNum, ExternalCrate)>,
57-
crate primitives: Vec<(DefId, PrimitiveType)>,
59+
crate primitives: ThinVec<(DefId, PrimitiveType)>,
5860
// These are later on moved into `CACHEKEY`, leaving the map empty.
5961
// Only here so that they can be filtered through the rustdoc passes.
6062
crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
@@ -73,8 +75,8 @@ crate struct ExternalCrate {
7375
crate name: Symbol,
7476
crate src: FileName,
7577
crate attrs: Attributes,
76-
crate primitives: Vec<(DefId, PrimitiveType)>,
77-
crate keywords: Vec<(DefId, Symbol)>,
78+
crate primitives: ThinVec<(DefId, PrimitiveType)>,
79+
crate keywords: ThinVec<(DefId, Symbol)>,
7880
}
7981

8082
/// Anything with a source location and set of attributes and, optionally, a

0 commit comments

Comments
 (0)