Skip to content

Commit 3bc879e

Browse files
committed
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.
1 parent b3d2a37 commit 3bc879e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustdoc/html/render/context.rs

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ crate struct Context<'tcx> {
7070
pub(super) cache: Rc<Cache>,
7171
}
7272

73+
// `Context` is cloned a lot, so we don't want the size to grow unexpectedly.
74+
#[cfg(target_arch = "x86_64")]
75+
rustc_data_structures::static_assert_size!(Context<'_>, 72);
76+
7377
impl<'tcx> Context<'tcx> {
7478
pub(super) fn path(&self, filename: &str) -> PathBuf {
7579
// We use splitn vs Path::extension here because we might get a filename

0 commit comments

Comments
 (0)