diff options
| author | Ralf Jung <post@ralfj.de> | 2024-06-08 11:26:56 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-06-08 18:17:55 +0200 |
| commit | eb584a23bfba55512af0a223cf4133b806ede178 (patch) | |
| tree | fecadfa0fdf6d7c1ecf085e65294c156e96de5fd /compiler/rustc_codegen_cranelift | |
| parent | 16e8803579e5914a17a4924f47faaefc040a982d (diff) | |
| download | rust-eb584a23bfba55512af0a223cf4133b806ede178.tar.gz rust-eb584a23bfba55512af0a223cf4133b806ede178.zip | |
offset_of: allow (unstably) taking the offset of slice tail fields
Diffstat (limited to 'compiler/rustc_codegen_cranelift')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 963e5de91ce..6d26ca0b899 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -832,9 +832,10 @@ fn codegen_stmt<'tcx>( let val = match null_op { NullOp::SizeOf => layout.size.bytes(), NullOp::AlignOf => layout.align.abi.bytes(), - NullOp::OffsetOf(fields) => { - layout.offset_of_subfield(fx, fields.iter()).bytes() - } + NullOp::OffsetOf(fields) => fx + .tcx + .offset_of_subfield(ParamEnv::reveal_all(), layout, fields.iter()) + .bytes(), NullOp::UbChecks => { let val = fx.tcx.sess.ub_checks(); let val = CValue::by_val( |
