about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2016-12-19 17:59:26 -0700
committerMark Simulacrum <mark.simulacrum@gmail.com>2016-12-20 20:04:43 -0700
commitd55e73954a1019a1f5dea8fdca752b8f8e6647ff (patch)
tree11f3b8ab3297ec0eabea413516b2925e43ea3261
parent6fac0a1a84891ccf38f0cfbaf7b93e1c64578bfb (diff)
Do not use BAB after calling unreachable.
This does not make unreachable and other terminators take self by-value
because it is deemed too difficult. We would need to create by-value
methods on BAB that call into Builder, due to the Deref to builder.
-rw-r--r--src/librustc_trans/callee.rs24
-rw-r--r--src/librustc_trans/meth.rs10
2 files changed, 18 insertions, 16 deletions
diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs
index 44e94a1dfe3..dea0a2664a0 100644
--- a/src/librustc_trans/callee.rs
+++ b/src/librustc_trans/callee.rs
@@ -385,13 +385,14 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
 
     if fn_ret.0.is_never() {
         bcx.unreachable();
-    }
-    self_scope.trans(&bcx);
-
-    if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
-        bcx.ret_void();
     } else {
-        bcx.ret(llret);
+        self_scope.trans(&bcx);
+
+        if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
+            bcx.ret_void();
+        } else {
+            bcx.ret(llret);
+        }
     }
 
     ccx.instances().borrow_mut().insert(method_instance, lloncefn);
@@ -521,13 +522,14 @@ fn trans_fn_pointer_shim<'a, 'tcx>(
 
     if fn_ret.0.is_never() {
         bcx.unreachable();
-    }
-
-    if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
-        bcx.ret_void();
     } else {
-        bcx.ret(llret);
+        if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
+            bcx.ret_void();
+        } else {
+            bcx.ret(llret);
+        }
     }
+
     ccx.fn_pointer_shims().borrow_mut().insert(bare_fn_ty_maybe_ref, llfn);
 
     llfn
diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs
index df893ac7ab0..89ea7a760d4 100644
--- a/src/librustc_trans/meth.rs
+++ b/src/librustc_trans/meth.rs
@@ -102,12 +102,12 @@ pub fn trans_object_shim<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
 
     if fn_ret.0.is_never() {
         bcx.unreachable();
-    }
-
-    if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
-        bcx.ret_void();
     } else {
-        bcx.ret(llret);
+        if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
+            bcx.ret_void();
+        } else {
+            bcx.ret(llret);
+        }
     }
 
     llfn