fix dropping non-primitive immediates

Closes #9446
This commit is contained in:
Daniel Micay 2013-09-30 22:40:44 -04:00
parent 4dd3ccb7ef
commit ab0a884a73
2 changed files with 4 additions and 16 deletions

View File

@ -77,19 +77,9 @@ pub fn drop_ty(cx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block {
pub fn drop_ty_immediate(bcx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block {
let _icx = push_ctxt("drop_ty_immediate");
match ty::get(t).sty {
ty::ty_uniq(_)
| ty::ty_evec(_, ty::vstore_uniq)
| ty::ty_estr(ty::vstore_uniq) => {
free_ty_immediate(bcx, v, t)
}
ty::ty_box(_) | ty::ty_opaque_box
| ty::ty_evec(_, ty::vstore_box)
| ty::ty_estr(ty::vstore_box) => {
decr_refcnt_maybe_free(bcx, v, None, t)
}
_ => bcx.tcx().sess.bug("drop_ty_immediate: non-box ty")
}
let vp = alloca(bcx, type_of(bcx.ccx(), t), "");
Store(bcx, v, vp);
drop_ty(bcx, vp, t)
}
pub fn free_ty(cx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-test
struct Wrapper(~str);
impl Wrapper {
@ -26,7 +24,7 @@ impl Drop for Wrapper {
fn drop(&mut self) {}
}
fn main() {
pub fn main() {
{
// This runs without complaint.
let x = Wrapper::new(~"Bob");