Skip to content

Commit

Permalink
Fixed premature assertions that caused -Z randomize-layout to fail on…
Browse files Browse the repository at this point in the history
… alloc
  • Loading branch information
Kixiron committed Jun 4, 2022
1 parent 6364179 commit ba2f14e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ pub fn unsize_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let mut result = None;
for i in 0..src_layout.fields.count() {
let src_f = src_layout.field(bx.cx(), i);
assert_eq!(src_layout.fields.offset(i).bytes(), 0);
assert_eq!(dst_layout.fields.offset(i).bytes(), 0);
if src_f.is_zst() {
continue;
}

assert_eq!(src_layout.fields.offset(i).bytes(), 0);
assert_eq!(dst_layout.fields.offset(i).bytes(), 0);
assert_eq!(src_layout.size, src_f.size);

let dst_f = dst_layout.field(bx.cx(), i);
Expand Down

0 comments on commit ba2f14e

Please sign in to comment.