Skip to content

Commit b8116da

Browse files
committed
fix oversight in closure translation
(Unrelated to this PR series)
1 parent b10b981 commit b8116da

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/librustc_trans/callee.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,8 @@ fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
600600
// reference. It also occurs when testing libcore and in some
601601
// other weird situations. Annoying.
602602

603-
let fn_ptr_ty = match fn_ty.sty {
604-
ty::TyFnDef(.., fty) => {
605-
// Create a fn pointer with the substituted signature.
606-
tcx.mk_fn_ptr(fty)
607-
}
608-
_ => bug!("expected fn item type for {:?}, found {}", def_id, fn_ty)
609-
};
603+
// Create a fn pointer with the substituted signature.
604+
let fn_ptr_ty = tcx.mk_fn_ptr(tcx.mk_bare_fn(common::ty_fn_ty(ccx, fn_ty).into_owned()));
610605
let llptrty = type_of::type_of(ccx, fn_ptr_ty);
611606

612607
let llfn = if let Some(llfn) = declare::get_declared_value(ccx, &sym) {

0 commit comments

Comments
 (0)