diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs index b9363fcf1b714..bc6d8369d0689 100644 --- a/src/rustdoc-json-types/tests.rs +++ b/src/rustdoc-json-types/tests.rs @@ -38,3 +38,30 @@ fn test_union_info_roundtrip() { let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap(); assert_eq!(u, decoded); } + +// The memory used by a `Crate` can get large. These types are the ones that +// contribute the most to its size. Ideally we'd use static assertions for +// these tests but that would require adding some kind of dependency that we +// don't want to rustdoc-json-types. +#[test] +#[cfg(target_pointer_width = "64")] +fn test_type_sizes() { + // tidy-alphabetical-start + assert_eq!(size_of::(), 112); + assert_eq!(size_of::(), 184); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 168); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 104); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 136); + assert_eq!(size_of::(), 304); + assert_eq!(size_of::(), 552); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 160); + // tidy-alphabetical-end +}