about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-11-14 18:23:07 -0500
committerNiko Matsakis <niko@alum.mit.edu>2016-11-17 13:44:22 -0500
commitb8116dabdaf5952ce676239b1e2d0a7684ce0c34 (patch)
tree3913aedd7c51ceae8bafaeea6cd1764efedc4200
parentb10b98169ff7350236e96f99ddb2f5d4cbef732b (diff)
downloadrust-b8116dabdaf5952ce676239b1e2d0a7684ce0c34.tar.gz
rust-b8116dabdaf5952ce676239b1e2d0a7684ce0c34.zip
fix oversight in closure translation
(Unrelated to this PR series)
-rw-r--r--src/librustc_trans/callee.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs
index a7553ce4995..df56e27128c 100644
--- a/src/librustc_trans/callee.rs
+++ b/src/librustc_trans/callee.rs
@@ -600,13 +600,8 @@ fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     // reference. It also occurs when testing libcore and in some
     // other weird situations. Annoying.
 
-    let fn_ptr_ty = match fn_ty.sty {
-        ty::TyFnDef(.., fty) => {
-            // Create a fn pointer with the substituted signature.
-            tcx.mk_fn_ptr(fty)
-        }
-        _ => bug!("expected fn item type for {:?}, found {}", def_id, fn_ty)
-    };
+    // Create a fn pointer with the substituted signature.
+    let fn_ptr_ty = tcx.mk_fn_ptr(tcx.mk_bare_fn(common::ty_fn_ty(ccx, fn_ty).into_owned()));
     let llptrty = type_of::type_of(ccx, fn_ptr_ty);
 
     let llfn = if let Some(llfn) = declare::get_declared_value(ccx, &sym) {