Skip to content

Commit 45e2582

Browse files
committed
stop copying the tydesc in unique box take glue
the only user of the tydesc is ~fn, and it doesn't use this glue code
1 parent 7f3752c commit 45e2582

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/librustc/middle/trans/closure.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ pub fn make_closure_glue(
486486
}
487487
}
488488

489+
// note: unique pointers no longer copy the type descriptor in the take glue,
490+
// so we cannot delegate to the unique box take glue here without copying it
491+
// ourselves
489492
pub fn make_opaque_cbox_take_glue(
490493
bcx: block,
491494
sigil: ast::Sigil,

src/librustc/middle/trans/uniq.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,5 @@ pub fn duplicate(bcx: block, src_box: ValueRef, src_ty: ty::t) -> Result {
5252
} = malloc_unique(bcx, body_datum.ty);
5353
body_datum.copy_to(bcx, datum::INIT, dst_body);
5454

55-
// Copy the type descriptor
56-
let src_tydesc_ptr = GEPi(bcx, src_box,
57-
[0u, back::abi::box_field_tydesc]);
58-
let dst_tydesc_ptr = GEPi(bcx, dst_box,
59-
[0u, back::abi::box_field_tydesc]);
60-
let td = Load(bcx, src_tydesc_ptr);
61-
Store(bcx, td, dst_tydesc_ptr);
62-
63-
return rslt(bcx, dst_box);
55+
rslt(bcx, dst_box)
6456
}

0 commit comments

Comments
 (0)