Skip to content

Commit

Permalink
Auto merge of #85311 - camelid:box-blanket-impl, r=jyn514
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
bors committed May 15, 2021
2 parents 428636f + f57537e commit c6dd87a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,7 @@ crate struct Impl {
crate items: Vec<Item>,
crate negative_polarity: bool,
crate synthetic: bool,
crate blanket_impl: Option<Type>,
crate blanket_impl: Option<Box<Type>>,
}

impl Impl {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ impl FromWithTcx<clean::Impl> 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)),
}
}
}
Expand Down

0 comments on commit c6dd87a

Please sign in to comment.