Change type_needs_drop to say that any class w/ a dtor needs a drop

This was preventing dtors from running for class types that didn't
have pointer fields.
This commit is contained in:
Tim Chevalier 2012-06-01 14:46:37 -07:00
parent 1e801baa84
commit bc5cb4deb3

View File

@ -1174,10 +1174,13 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
accum
}
ty_class(did, substs) {
for vec::each(ty::class_items_as_fields(cx, did, substs)) {|f|
if type_needs_drop(cx, f.mt.ty) { accum = true; }
}
accum
// Any class with a dtor needs a drop
option::is_some(ty_dtor(cx, did)) || {
for vec::each(ty::class_items_as_fields(cx, did, substs)) {|f|
if type_needs_drop(cx, f.mt.ty) { accum = true; }
}
accum
}
}
ty_tup(elts) {