about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2021-02-21 17:19:43 -0800
committerCamelid <camelidcamel@gmail.com>2021-03-05 19:39:17 -0800
commit3bc879e76bb428d42831179829606dede0c84f94 (patch)
tree1391ed6b184097fdb53736905b3466f482778ee8
parentb3d2a371bb8c0bccbc07d3a29c79218495549509 (diff)
downloadrust-3bc879e76bb428d42831179829606dede0c84f94.tar.gz
rust-3bc879e76bb428d42831179829606dede0c84f94.zip
rustdoc: Add static size assertion for `Context`
It's cloned a lot, so we don't want it to grow in size unexpectedly.

Only run the assert on x86-64 since the size is architecture-dependent.
-rw-r--r--src/librustdoc/html/render/context.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index e8d323b9af1..50d160ccd82 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -70,6 +70,10 @@ crate struct Context<'tcx> {
     pub(super) cache: Rc<Cache>,
 }
 
+// `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<'_>, 72);
+
 impl<'tcx> Context<'tcx> {
     pub(super) fn path(&self, filename: &str) -> PathBuf {
         // We use splitn vs Path::extension here because we might get a filename