Skip to content

Commit

Permalink
Auto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Apr 6, 2021
2 parents c051c5d + 3ea8ebc commit 8b53ec6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ use std::sync::Arc;
use std::{slice, vec};

use arrayvec::ArrayVec;

use rustc_ast::attr;
use rustc_ast::util::comments::beautify_doc_string;
use rustc_ast::{self as ast, AttrStyle};
use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::thin_vec::ThinVec;
use rustc_feature::UnstableFeatures;
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, Res};
Expand Down Expand Up @@ -54,7 +56,7 @@ crate struct Crate {
crate src: FileName,
crate module: Item,
crate externs: Vec<(CrateNum, ExternalCrate)>,
crate primitives: Vec<(DefId, PrimitiveType)>,
crate primitives: ThinVec<(DefId, PrimitiveType)>,
// These are later on moved into `CACHEKEY`, leaving the map empty.
// Only here so that they can be filtered through the rustdoc passes.
crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
Expand All @@ -73,8 +75,8 @@ crate struct ExternalCrate {
crate name: Symbol,
crate src: FileName,
crate attrs: Attributes,
crate primitives: Vec<(DefId, PrimitiveType)>,
crate keywords: Vec<(DefId, Symbol)>,
crate primitives: ThinVec<(DefId, PrimitiveType)>,
crate keywords: ThinVec<(DefId, Symbol)>,
}

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

0 comments on commit 8b53ec6

Please sign in to comment.