Skip to content

Commit

Permalink
fix a sized deallocation issue in the glue code
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Sep 6, 2014
1 parent 6eabd85 commit 395e453
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/librustc/middle/trans/glue.rs
Expand Up @@ -111,17 +111,14 @@ pub fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t {
return ty::mk_i8();
}
match ty::get(t).sty {
ty::ty_box(typ) if !ty::type_needs_drop(tcx, typ) =>
ty::mk_box(tcx, ty::mk_i8()),

ty::ty_uniq(typ) if !ty::type_needs_drop(tcx, typ)
&& ty::type_is_sized(tcx, typ) => {
let llty = sizing_type_of(ccx, typ);
// `Box<ZeroSizeType>` does not allocate.
if llsize_of_alloc(ccx, llty) == 0 {
ty::mk_i8()
} else {
ty::mk_uniq(tcx, ty::mk_i8())
t
}
}
_ => t
Expand Down

0 comments on commit 395e453

Please sign in to comment.