]> git.lizzy.rs Git - rust.git/commitdiff
check the the right field
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>
Sat, 26 Mar 2022 07:08:51 +0000 (00:08 -0700)
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>
Sat, 26 Mar 2022 07:08:51 +0000 (00:08 -0700)
compiler/rustc_codegen_ssa/src/mir/place.rs

index 12cdc2b2c7d3d46ea7d52e352ae62d714c63499a..be8b0f3c991253e7a814d094189abed5840421a4 100644 (file)
@@ -455,7 +455,7 @@ pub fn codegen_place(
             cg_base = match elem.clone() {
                 mir::ProjectionElem::Deref => {
                     // 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() {
+                    if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 1).is_zst() {
                         let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);
 
                         bx.load_operand(ptr).deref(bx.cx())