From 32b2b429499cbfad144ac28ca831dc71c8f980b4 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 12 Dec 2020 11:01:19 -0500 Subject: [PATCH] Box Typedef to reduce the size of ItemKind --- src/librustdoc/clean/mod.rs | 4 ++-- src/librustdoc/clean/types.rs | 2 +- src/librustdoc/html/render/mod.rs | 4 ++-- src/librustdoc/json/conversions.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 339463aa66ce3..f49ae9030141e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1270,7 +1270,7 @@ impl Clean for ty::AssocItem { let type_ = cx.tcx.type_of(self.def_id).clean(cx); let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did)); TypedefItem( - Typedef { + box Typedef { type_, generics: Generics { params: Vec::new(), where_predicates: Vec::new() }, item_type, @@ -1981,7 +1981,7 @@ impl Clean> for (&hir::Item<'_>, Option) { let rustdoc_ty = ty.clean(cx); let item_type = rustdoc_ty.def_id().and_then(|did| inline::build_ty(cx, did)); TypedefItem( - Typedef { type_: rustdoc_ty, generics: generics.clean(cx), item_type }, + box Typedef { type_: rustdoc_ty, generics: generics.clean(cx), item_type }, false, ) } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 7c685e9e2b33f..cbb4d5dfd6c8d 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -307,7 +307,7 @@ crate enum ItemKind { EnumItem(Enum), FunctionItem(Box), ModuleItem(Module), - TypedefItem(Typedef, bool /* is associated type */), + TypedefItem(Box, bool /* is associated type */), OpaqueTyItem(OpaqueTy), StaticItem(Static), ConstantItem(Constant), diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index db04624dca848..d875bdca8ad13 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -3559,7 +3559,7 @@ fn render_deref_methods( .items .iter() .find_map(|item| match item.kind { - clean::TypedefItem(ref t, true) => Some(match *t { + clean::TypedefItem(ref t, true) => Some(match **t { clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), _ => (&t.type_, &t.type_), }), @@ -4237,7 +4237,7 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { { if let Some((target, real_target)) = impl_.inner_impl().items.iter().find_map(|item| match item.kind { - clean::TypedefItem(ref t, true) => Some(match *t { + clean::TypedefItem(ref t, true) => Some(match **t { clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), _ => (&t.type_, &t.type_), }), diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 9fa8428af5dc1..1a4bd0b6916de 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -179,7 +179,7 @@ impl From for ItemEnum { StaticItem(s) => ItemEnum::StaticItem(s.into()), ForeignStaticItem(s) => ItemEnum::StaticItem(s.into()), ForeignTypeItem => ItemEnum::ForeignTypeItem, - TypedefItem(t, _) => ItemEnum::TypedefItem(t.into()), + TypedefItem(box t, _) => ItemEnum::TypedefItem(t.into()), OpaqueTyItem(t) => ItemEnum::OpaqueTyItem(t.into()), ConstantItem(c) => ItemEnum::ConstantItem(c.into()), MacroItem(m) => ItemEnum::MacroItem(m.source),