Skip to content

Commit c6dd87a

Browse files
committed
Auto merge of #85311 - camelid:box-blanket-impl, r=jyn514
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<Type>` is around 96 bytes, and `Option<Box<Type>>` is 8 bytes, so it's a big difference!
2 parents 428636f + f57537e commit c6dd87a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
119119
.clean(self.cx),
120120
negative_polarity: false,
121121
synthetic: false,
122-
blanket_impl: Some(trait_ref.self_ty().clean(self.cx)),
122+
blanket_impl: Some(box trait_ref.self_ty().clean(self.cx)),
123123
}),
124124
cfg: None,
125125
});

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,7 @@ crate struct Impl {
22352235
crate items: Vec<Item>,
22362236
crate negative_polarity: bool,
22372237
crate synthetic: bool,
2238-
crate blanket_impl: Option<Type>,
2238+
crate blanket_impl: Option<Box<Type>>,
22392239
}
22402240

22412241
impl Impl {

src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ impl FromWithTcx<clean::Impl> for Impl {
482482
items: ids(items),
483483
negative: negative_polarity,
484484
synthetic,
485-
blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)),
485+
blanket_impl: blanket_impl.map(|x| (*x).into_tcx(tcx)),
486486
}
487487
}
488488
}

0 commit comments

Comments
 (0)