From f57537e5f3f81426c0eed2a318efe636e9966174 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Fri, 14 May 2021 17:36:58 -0700 Subject: [PATCH] Box `Impl.blanket_impl` to reduce size Blanket impls are probably not super common, and `Type` is a fairly large type, so this should reduce `Impl`'s size by a lot: `Option` is around 96 bytes, and `Option>` is 8 bytes, so it's a big difference! --- src/librustdoc/clean/blanket_impl.rs | 2 +- src/librustdoc/clean/types.rs | 2 +- src/librustdoc/json/conversions.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 68856f82fe94c..090314e3a4bbd 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -119,7 +119,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { .clean(self.cx), negative_polarity: false, synthetic: false, - blanket_impl: Some(trait_ref.self_ty().clean(self.cx)), + blanket_impl: Some(box trait_ref.self_ty().clean(self.cx)), }), cfg: None, }); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 7d802636bfac2..f0e0401824265 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2235,7 +2235,7 @@ crate struct Impl { crate items: Vec, crate negative_polarity: bool, crate synthetic: bool, - crate blanket_impl: Option, + crate blanket_impl: Option>, } impl Impl { diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index e0e5db3b5634b..d2349b42ae930 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -482,7 +482,7 @@ impl FromWithTcx for Impl { items: ids(items), negative: negative_polarity, synthetic, - blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)), + blanket_impl: blanket_impl.map(|x| (*x).into_tcx(tcx)), } } }