@@ -382,3 +382,33 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
382382 & self . cache
383383 }
384384}
385+
386+ // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
387+ //
388+ // These assertions are here, not in `src/rustdoc-json-types/lib.rs` where the types are defined,
389+ // because we have access to `static_assert_size` here.
390+ #[ cfg( target_pointer_width = "64" ) ]
391+ mod size_asserts {
392+ use rustc_data_structures:: static_assert_size;
393+
394+ use super :: types:: * ;
395+ // tidy-alphabetical-start
396+ static_assert_size ! ( AssocItemConstraint , 208 ) ;
397+ static_assert_size ! ( Crate , 184 ) ;
398+ static_assert_size ! ( ExternalCrate , 48 ) ;
399+ static_assert_size ! ( FunctionPointer , 168 ) ;
400+ static_assert_size ! ( GenericArg , 80 ) ;
401+ static_assert_size ! ( GenericArgs , 104 ) ;
402+ static_assert_size ! ( GenericBound , 72 ) ;
403+ static_assert_size ! ( GenericParamDef , 136 ) ;
404+ static_assert_size ! ( Impl , 304 ) ;
405+ // `Item` contains a `PathBuf`, which is different sizes on different OSes.
406+ static_assert_size ! ( Item , 528 + size_of:: <std:: path:: PathBuf >( ) ) ;
407+ static_assert_size ! ( ItemSummary , 32 ) ;
408+ static_assert_size ! ( PolyTrait , 64 ) ;
409+ static_assert_size ! ( PreciseCapturingArg , 32 ) ;
410+ static_assert_size ! ( TargetFeature , 80 ) ;
411+ static_assert_size ! ( Type , 80 ) ;
412+ static_assert_size ! ( WherePredicate , 160 ) ;
413+ // tidy-alphabetical-end
414+ }
0 commit comments