diff options
| author | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2022-03-25 23:14:30 -0700 |
|---|---|---|
| committer | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2022-03-25 23:16:23 -0700 |
| commit | 46dadfc1422ce98f4814441154d5fa765caeffe9 (patch) | |
| tree | d28adf7c7fafc8aa3033c686783a5e78f34aeca7 /compiler/rustc_codegen_ssa/src | |
| parent | d4acac935b6dd6413964b068421d8d12441f702e (diff) | |
| download | rust-46dadfc1422ce98f4814441154d5fa765caeffe9.tar.gz rust-46dadfc1422ce98f4814441154d5fa765caeffe9.zip | |
widen special case on deref to all non-zst allocators
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/place.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 2b8fa3be56d..12cdc2b2c7d 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -454,10 +454,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { for elem in place_ref.projection[base..].iter() { cg_base = match elem.clone() { mir::ProjectionElem::Deref => { - // custom allocators can change box's abi, making it unable to be derefed directly - if cg_base.layout.ty.is_box() - && matches!(cg_base.layout.abi, Abi::Aggregate { .. } | Abi::Uninhabited) - { + // a box with a non-zst allocator should not be directly dereferenced + if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 0).is_zst() { let ptr = cg_base.project_field(bx, 0).project_field(bx, 0); bx.load_operand(ptr).deref(bx.cx()) |
