about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2021-03-01 16:30:58 -0800
committerCamelid <camelidcamel@gmail.com>2021-03-05 19:41:27 -0800
commitff39c46959b0c6926c0199f59f65af585e131e7d (patch)
tree07b0e7194fbe0a23adcd6df54754d9fadfa33268
parent4c51a66d674c32b3d8eeebcd1ae276611e9f4c12 (diff)
downloadrust-ff39c46959b0c6926c0199f59f65af585e131e7d.tar.gz
rust-ff39c46959b0c6926c0199f59f65af585e131e7d.zip
Box some fields to reduce `Context` size
Reduced from 152 bytes to 88 bytes.
-rw-r--r--src/librustdoc/html/render/context.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index c2dfb64b2ab..23c2a925105 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -53,10 +53,10 @@ crate struct Context<'tcx> {
     /// publicly reused items to redirect to the right location.
     pub(super) render_redirect_pages: bool,
     /// The map used to ensure all generated 'id=' attributes are unique.
-    pub(super) id_map: RefCell<IdMap>,
+    pub(super) id_map: Box<RefCell<IdMap>>,
     /// Tracks section IDs for `Deref` targets so they match in both the main
     /// body and the sidebar.
-    pub(super) deref_id_map: RefCell<FxHashMap<DefId, String>>,
+    pub(super) deref_id_map: Box<RefCell<FxHashMap<DefId, String>>>,
     /// Shared mutable state.
     ///
     /// Issue for improving the situation: [#82381][]
@@ -77,7 +77,7 @@ crate struct Context<'tcx> {
 
 // `Context` is cloned a lot, so we don't want the size to grow unexpectedly.
 #[cfg(target_arch = "x86_64")]
-rustc_data_structures::static_assert_size!(Context<'_>, 152);
+rustc_data_structures::static_assert_size!(Context<'_>, 88);
 
 impl<'tcx> Context<'tcx> {
     pub(super) fn path(&self, filename: &str) -> PathBuf {
@@ -421,8 +421,8 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
             current: Vec::new(),
             dst,
             render_redirect_pages: false,
-            id_map: RefCell::new(id_map),
-            deref_id_map: RefCell::new(FxHashMap::default()),
+            id_map: Box::new(RefCell::new(id_map)),
+            deref_id_map: Box::new(RefCell::new(FxHashMap::default())),
             shared: Rc::new(scx),
             cache: Rc::new(cache),
         };