parent
cced02fcac
commit
de2567dec9
2 changed files with 19 additions and 2 deletions
|
@ -1802,11 +1802,15 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
|
|||
RvalueExpr(Rvalue { mode: ByRef }) => {
|
||||
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
|
||||
let ptr = Load(bcx, datum.val);
|
||||
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange);
|
||||
if !type_is_zero_size(bcx.ccx(), content_ty) {
|
||||
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange);
|
||||
}
|
||||
}
|
||||
RvalueExpr(Rvalue { mode: ByValue }) => {
|
||||
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
|
||||
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange);
|
||||
if !type_is_zero_size(bcx.ccx(), content_ty) {
|
||||
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange);
|
||||
}
|
||||
}
|
||||
LvalueExpr => { }
|
||||
}
|
||||
|
|
13
src/test/run-pass/empty-allocation-rvalue-non-null.rs
Normal file
13
src/test/run-pass/empty-allocation-rvalue-non-null.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
let x = *~();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue