Skip to content

Commit

Permalink
Don't emit memcpy's for zero-sized types
Browse files Browse the repository at this point in the history
  • Loading branch information
dotdash committed Aug 22, 2015
1 parent 3a407b6 commit e75abd3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_trans/trans/base.rs
Expand Up @@ -956,6 +956,11 @@ pub fn memcpy_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
t: Ty<'tcx>) {
let _icx = push_ctxt("memcpy_ty");
let ccx = bcx.ccx();

if type_is_zero_size(ccx, t) {
return;
}

if t.is_structural() {
let llty = type_of::type_of(ccx, t);
let llsz = llsize_of(ccx, llty);
Expand Down

0 comments on commit e75abd3

Please sign in to comment.