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.
This commit is contained in:
Camelid 2021-02-21 17:19:43 -08:00
parent b3d2a371bb
commit 3bc879e76b

View file

@ -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