Skip to content

Commit 6df0d6c

Browse files
dotdashBjörn Steinbrink
authored andcommitted
---
yaml --- r: 64096 b: refs/heads/snap-stage3 c: 4a485f8 h: refs/heads/master v: v3
1 parent 845d771 commit 6df0d6c

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 48ad726f2abc90fe62cdf239bc1c9318261a6926
4+
refs/heads/snap-stage3: 4a485f8cec524c8f3f57e4fd3248d5093ed3dc5f
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/callee.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,8 @@ pub fn trans_call_inner(in_cx: block,
672672
expr::Ignore => {
673673
// drop the value if it is not being saved.
674674
unsafe {
675-
if llvm::LLVMIsUndef(llretslot) != lib::llvm::True {
676-
if ty::type_is_nil(ret_ty) {
677-
// When implementing the for-loop sugar syntax, the
678-
// type of the for-loop is nil, but the function
679-
// it's invoking returns a bool. This is a special
680-
// case to ignore instead of invoking the Store
681-
// below into a scratch pointer of a mismatched
682-
// type.
683-
} else if ty::type_is_immediate(bcx.tcx(), ret_ty) {
675+
if ty::type_needs_drop(bcx.tcx(), ret_ty) {
676+
if ty::type_is_immediate(bcx.tcx(), ret_ty) {
684677
let llscratchptr = alloc_ty(bcx, ret_ty);
685678
Store(bcx, llresult, llscratchptr);
686679
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
@@ -734,7 +727,7 @@ pub fn trans_ret_slot(bcx: block, fn_ty: ty::t, dest: expr::Dest)
734727
match dest {
735728
expr::SaveIn(dst) => dst,
736729
expr::Ignore => {
737-
if ty::type_is_nil(retty) {
730+
if ty::type_is_immediate(bcx.tcx(), retty) {
738731
unsafe {
739732
llvm::LLVMGetUndef(Type::nil().ptr_to().to_ref())
740733
}

0 commit comments

Comments
 (0)