@@ -672,15 +672,8 @@ pub fn trans_call_inner(in_cx: block,
672
672
expr:: Ignore => {
673
673
// drop the value if it is not being saved.
674
674
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) {
684
677
let llscratchptr = alloc_ty ( bcx, ret_ty) ;
685
678
Store ( bcx, llresult, llscratchptr) ;
686
679
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)
734
727
match dest {
735
728
expr : : SaveIn ( dst) => dst,
736
729
expr : : Ignore => {
737
- if ty:: type_is_nil ( retty) {
730
+ if ty:: type_is_immediate ( bcx . tcx ( ) , retty) {
738
731
unsafe {
739
732
llvm:: LLVMGetUndef ( Type :: nil( ) . ptr_to( ) . to_ref( ) )
740
733
}
0 commit comments