1
Fork 0

fix failure to detect a too-big-type after adding padding

This commit is contained in:
Ralf Jung 2023-10-27 13:19:24 +02:00
parent 707d8c3f1b
commit 2ef5897a89
4 changed files with 34 additions and 0 deletions

View file

@ -19,6 +19,9 @@ pub(super) fn sanity_check_layout<'tcx>(
if layout.size.bytes() % layout.align.abi.bytes() != 0 {
bug!("size is not a multiple of align, in the following layout:\n{layout:#?}");
}
if layout.size.bytes() >= cx.tcx.data_layout.obj_size_bound() {
bug!("size is too large, in the following layout:\n{layout:#?}");
}
if !cfg!(debug_assertions) {
// Stop here, the rest is kind of expensive.