about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-10-27 13:19:24 +0200
committerRalf Jung <post@ralfj.de>2023-10-27 18:07:53 +0200
commit2ef5897a89f9bbd9d38b9eb1222b5bedef98814b (patch)
treef3bfff1b326c0256de5b385b377cb2af1cc674a8 /compiler/rustc_ty_utils
parent707d8c3f1bba10d5aaa9c8719c410711edf2e227 (diff)
downloadrust-2ef5897a89f9bbd9d38b9eb1222b5bedef98814b.tar.gz
rust-2ef5897a89f9bbd9d38b9eb1222b5bedef98814b.zip
fix failure to detect a too-big-type after adding padding
Diffstat (limited to 'compiler/rustc_ty_utils')
-rw-r--r--compiler/rustc_ty_utils/src/layout_sanity_check.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_ty_utils/src/layout_sanity_check.rs b/compiler/rustc_ty_utils/src/layout_sanity_check.rs
index 8633334381a..6332c614a90 100644
--- a/compiler/rustc_ty_utils/src/layout_sanity_check.rs
+++ b/compiler/rustc_ty_utils/src/layout_sanity_check.rs
@@ -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.