Bug fix: Rvalue(ByRef) will issue a lifetime_end as its post_store, which is wrong.

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.
This commit is contained in:
Felix S. Klock II 2015-04-27 16:21:51 +02:00
parent 24f213d023
commit 805349a50b

View 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();