Skip to content

Commit 98e52c2

Browse files
committed
check 'size multiple of align' for all layouts
1 parent a231865 commit 98e52c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/layout.rs

+4
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ fn sanity_check_layout<'tcx>(
232232
assert!(layout.abi.is_uninhabited());
233233
}
234234

235+
if layout.size.bytes() % layout.align.abi.bytes() != 0 {
236+
bug!("size is not a multiple of align, in the following layout:\n{layout:#?}");
237+
}
238+
235239
if cfg!(debug_assertions) {
236240
fn check_layout_abi<'tcx>(tcx: TyCtxt<'tcx>, layout: Layout<'tcx>) {
237241
match layout.abi() {

0 commit comments

Comments
 (0)