Skip to content

Commit cbb3906

Browse files
committed
---
yaml --- r: 45034 b: refs/heads/master c: b6bcf1a h: refs/heads/master v: v3
1 parent 4ffe1be commit cbb3906

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 71b6e945c11a3a0f44e5e45bcad4e7bddf35ba8a
2+
refs/heads/master: b6bcf1a81f14223b9108c724794d388db1233905
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/librustc/middle/trans/adt.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ fn struct_GEP(bcx: block, st: &Struct, val: ValueRef, ix: uint,
266266
GEPi(bcx, val, [0, ix])
267267
}
268268

269+
pub fn trans_drop_flag_ptr(bcx: block, r: &Repr, val: ValueRef) -> ValueRef {
270+
match *r {
271+
Univariant(_, DtorPresent) => GEPi(bcx, val, [0, 1]),
272+
_ => bcx.ccx().sess.bug(~"tried to get drop flag of non-droppable \
273+
type")
274+
}
275+
}
276+
269277
pub fn trans_const(ccx: @CrateContext, r: &Repr, discr: int,
270278
vals: &[ValueRef]) -> ValueRef {
271279
match *r {

trunk/src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ pub fn trans_struct_drop(bcx: block,
468468
substs: &ty::substs,
469469
take_ref: bool)
470470
-> block {
471-
let drop_flag = GEPi(bcx, v0, struct_dtor());
471+
let repr = adt::represent_type(bcx.ccx(), t);
472+
let drop_flag = adt::trans_drop_flag_ptr(bcx, &repr, v0);
472473
do with_cond(bcx, IsNotNull(bcx, Load(bcx, drop_flag))) |cx| {
473474
let mut bcx = cx;
474475

@@ -502,7 +503,6 @@ pub fn trans_struct_drop(bcx: block,
502503
Call(bcx, dtor_addr, args);
503504

504505
// Drop the fields
505-
let repr = adt::represent_type(bcx.ccx(), t);
506506
let field_tys =
507507
ty::struct_mutable_fields(bcx.tcx(), class_did,
508508
substs);

0 commit comments

Comments
 (0)