diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-06-01 14:46:37 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-06-01 20:40:34 -0700 |
| commit | bc5cb4deb34cc767af20eedc55fed5f528680938 (patch) | |
| tree | c8b80382e95de03fc6432f9d7359c7d542e4d2c9 /src/rustc | |
| parent | 1e801baa84af732651e0210f181ca3572a62e459 (diff) | |
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.
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/middle/ty.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 07f6e7749ec..385159bbfbc 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -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) { |
