Skip to content

Commit 4f2f512

Browse files
thestingeralexcrichton
authored andcommitted
---
yaml --- r: 110542 b: refs/heads/master c: de2567d h: refs/heads/master v: v3
1 parent cd82bb0 commit 4f2f512

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cced02fcacfe4a6d1598e987003e00aa65713efb
2+
refs/heads/master: de2567dec9cfceec59db5d6d17df09c05f70d5a1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: e263ef1df7b892ed29e53313565eb05ab75e52f4
55
refs/heads/try: 597a645456b55e1c886ce15d23a192abdf4d55cf

trunk/src/librustc/middle/trans/expr.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,11 +1802,15 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
18021802
RvalueExpr(Rvalue { mode: ByRef }) => {
18031803
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
18041804
let ptr = Load(bcx, datum.val);
1805-
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange);
1805+
if !type_is_zero_size(bcx.ccx(), content_ty) {
1806+
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange);
1807+
}
18061808
}
18071809
RvalueExpr(Rvalue { mode: ByValue }) => {
18081810
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
1809-
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange);
1811+
if !type_is_zero_size(bcx.ccx(), content_ty) {
1812+
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange);
1813+
}
18101814
}
18111815
LvalueExpr => { }
18121816
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub fn main() {
12+
let x = *~();
13+
}

0 commit comments

Comments
 (0)