Skip to content

Commit d55e739

Browse files
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.
1 parent 6fac0a1 commit d55e739

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/librustc_trans/callee.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,14 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
385385

386386
if fn_ret.0.is_never() {
387387
bcx.unreachable();
388-
}
389-
self_scope.trans(&bcx);
390-
391-
if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
392-
bcx.ret_void();
393388
} else {
394-
bcx.ret(llret);
389+
self_scope.trans(&bcx);
390+
391+
if fcx.fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
392+
bcx.ret_void();
393+
} else {
394+
bcx.ret(llret);
395+
}
395396
}
396397

397398
ccx.instances().borrow_mut().insert(method_instance, lloncefn);
@@ -521,13 +522,14 @@ fn trans_fn_pointer_shim<'a, 'tcx>(
521522

522523
if fn_ret.0.is_never() {
523524
bcx.unreachable();
524-
}
525-
526-
if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
527-
bcx.ret_void();
528525
} else {
529-
bcx.ret(llret);
526+
if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
527+
bcx.ret_void();
528+
} else {
529+
bcx.ret(llret);
530+
}
530531
}
532+
531533
ccx.fn_pointer_shims().borrow_mut().insert(bare_fn_ty_maybe_ref, llfn);
532534

533535
llfn

src/librustc_trans/meth.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ pub fn trans_object_shim<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
102102

103103
if fn_ret.0.is_never() {
104104
bcx.unreachable();
105-
}
106-
107-
if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
108-
bcx.ret_void();
109105
} else {
110-
bcx.ret(llret);
106+
if fn_ty.ret.is_indirect() || fcx.fn_ty.ret.is_ignore() {
107+
bcx.ret_void();
108+
} else {
109+
bcx.ret(llret);
110+
}
111111
}
112112

113113
llfn

0 commit comments

Comments
 (0)