Skip to content

Commit 32b2b42

Browse files
committed
Box Typedef to reduce the size of ItemKind
1 parent 0b82a25 commit 32b2b42

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ impl Clean<Item> for ty::AssocItem {
12701270
let type_ = cx.tcx.type_of(self.def_id).clean(cx);
12711271
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
12721272
TypedefItem(
1273-
Typedef {
1273+
box Typedef {
12741274
type_,
12751275
generics: Generics { params: Vec::new(), where_predicates: Vec::new() },
12761276
item_type,
@@ -1981,7 +1981,7 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Symbol>) {
19811981
let rustdoc_ty = ty.clean(cx);
19821982
let item_type = rustdoc_ty.def_id().and_then(|did| inline::build_ty(cx, did));
19831983
TypedefItem(
1984-
Typedef { type_: rustdoc_ty, generics: generics.clean(cx), item_type },
1984+
box Typedef { type_: rustdoc_ty, generics: generics.clean(cx), item_type },
19851985
false,
19861986
)
19871987
}

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ crate enum ItemKind {
307307
EnumItem(Enum),
308308
FunctionItem(Box<Function>),
309309
ModuleItem(Module),
310-
TypedefItem(Typedef, bool /* is associated type */),
310+
TypedefItem(Box<Typedef>, bool /* is associated type */),
311311
OpaqueTyItem(OpaqueTy),
312312
StaticItem(Static),
313313
ConstantItem(Constant),

src/librustdoc/html/render/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3559,7 +3559,7 @@ fn render_deref_methods(
35593559
.items
35603560
.iter()
35613561
.find_map(|item| match item.kind {
3562-
clean::TypedefItem(ref t, true) => Some(match *t {
3562+
clean::TypedefItem(ref t, true) => Some(match **t {
35633563
clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_),
35643564
_ => (&t.type_, &t.type_),
35653565
}),
@@ -4237,7 +4237,7 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
42374237
{
42384238
if let Some((target, real_target)) =
42394239
impl_.inner_impl().items.iter().find_map(|item| match item.kind {
4240-
clean::TypedefItem(ref t, true) => Some(match *t {
4240+
clean::TypedefItem(ref t, true) => Some(match **t {
42414241
clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_),
42424242
_ => (&t.type_, &t.type_),
42434243
}),

src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl From<clean::ItemKind> for ItemEnum {
179179
StaticItem(s) => ItemEnum::StaticItem(s.into()),
180180
ForeignStaticItem(s) => ItemEnum::StaticItem(s.into()),
181181
ForeignTypeItem => ItemEnum::ForeignTypeItem,
182-
TypedefItem(t, _) => ItemEnum::TypedefItem(t.into()),
182+
TypedefItem(box t, _) => ItemEnum::TypedefItem(t.into()),
183183
OpaqueTyItem(t) => ItemEnum::OpaqueTyItem(t.into()),
184184
ConstantItem(c) => ItemEnum::ConstantItem(c.into()),
185185
MacroItem(m) => ItemEnum::MacroItem(m.source),

0 commit comments

Comments
 (0)