]> git.lizzy.rs Git - rust.git/commitdiff
Bug fix: `Rvalue(ByRef)` will issue a lifetime_end as its post_store, which is wrong.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Mon, 27 Apr 2015 14:21:51 +0000 (16:21 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Mon, 27 Apr 2015 14:21:51 +0000 (16:21 +0200)
Kudos to dotdash for tracking down this fix.

Presumably the use of `ByRef` was because this value is a reference to
the drop-flag; but an Lvalue will serve just as well for that. dotdash
argues:

> since the drop_flag is in its "final home", Lvalue seems to be the
> correct choice.

src/librustc_trans/trans/adt.rs

index 2057f502c1b69e2f31769766c85c7a17ea69b9b1..87ee13355971ab4bf9b676e5678217d96f9c78af 100644 (file)
@@ -1061,7 +1061,7 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, r: &Repr<'tcx
             ));
             bcx = fold_variants(bcx, r, val, |variant_cx, st, value| {
                 let ptr = struct_field_ptr(variant_cx, st, value, (st.fields.len() - 1), false);
-                datum::Datum::new(ptr, ptr_ty, datum::Rvalue::new(datum::ByRef))
+                datum::Datum::new(ptr, ptr_ty, datum::Lvalue)
                     .store_to(variant_cx, scratch.val)
             });
             let expr_datum = scratch.to_expr_datum();