1
Fork 0

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!
This commit is contained in:
bors 2021-05-15 07:44:21 +00:00
commit c6dd87a6b4
3 changed files with 3 additions and 3 deletions

View file

@ -119,7 +119,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
.clean(self.cx), .clean(self.cx),
negative_polarity: false, negative_polarity: false,
synthetic: 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, cfg: None,
}); });

View file

@ -2235,7 +2235,7 @@ crate struct Impl {
crate items: Vec<Item>, crate items: Vec<Item>,
crate negative_polarity: bool, crate negative_polarity: bool,
crate synthetic: bool, crate synthetic: bool,
crate blanket_impl: Option<Type>, crate blanket_impl: Option<Box<Type>>,
} }
impl Impl { impl Impl {

View file

@ -482,7 +482,7 @@ impl FromWithTcx<clean::Impl> for Impl {
items: ids(items), items: ids(items),
negative: negative_polarity, negative: negative_polarity,
synthetic, synthetic,
blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)), blanket_impl: blanket_impl.map(|x| (*x).into_tcx(tcx)),
} }
} }
} }