1
Fork 0

offset_of: allow (unstably) taking the offset of slice tail fields

This commit is contained in:
Ralf Jung 2024-06-08 11:26:56 +02:00
parent 16e8803579
commit eb584a23bf
17 changed files with 215 additions and 46 deletions

View file

@ -680,7 +680,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.cx().const_usize(val)
}
mir::NullOp::OffsetOf(fields) => {
let val = layout.offset_of_subfield(bx.cx(), fields.iter()).bytes();
let val = bx
.tcx()
.offset_of_subfield(bx.param_env(), layout, fields.iter())
.bytes();
bx.cx().const_usize(val)
}
mir::NullOp::UbChecks => {