diff options
| author | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2022-03-11 17:00:56 -0800 |
|---|---|---|
| committer | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2022-03-11 17:00:56 -0800 |
| commit | 9d72dd54d0fac28e3611ff553edbbd695f6e8357 (patch) | |
| tree | 33871edc0c4ba45ef44af6ae9d88fab394f84b39 /compiler/rustc_codegen_ssa | |
| parent | c5a43b8d3917d15b30b7d99021540cf7831f4182 (diff) | |
| download | rust-9d72dd54d0fac28e3611ff553edbbd695f6e8357.tar.gz rust-9d72dd54d0fac28e3611ff553edbbd695f6e8357.zip | |
fix another assumption about box
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 66be58cf62c..858f71ebc39 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -126,7 +126,14 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { .ty; let (llptr, llextra) = match self.val { OperandValue::Immediate(llptr) => (llptr, None), - OperandValue::Pair(llptr, llextra) => (llptr, Some(llextra)), + OperandValue::Pair(llptr, llextra) => { + // if the box's allocator isn't a ZST, then "llextra" is actually the allocator + if self.layout.ty.is_box() && !self.layout.field(cx, 1).is_zst() { + (llptr, None) + } else { + (llptr, Some(llextra)) + } + } OperandValue::Ref(..) => bug!("Deref of by-Ref operand {:?}", self), }; let layout = cx.layout_of(projected_ty); |
