});
let function_type = ccx.tcx().mk_closure_from_closure_substs(closure_id, Box::new(substs));
- let llfn = declare::define_internal_rust_fn(ccx, &symbol[..], function_type).unwrap_or_else(||{
- ccx.sess().bug(&format!("symbol `{}` already defined", symbol));
- });
+ let llfn = declare::define_internal_rust_fn(ccx, &symbol[..], function_type);
// set an inline hint for all closures
attributes::inline(llfn, attributes::InlineAttr::Hint);
MetadataCreationResult::new(pointer_type_metadata(cx, t, fn_metadata), false)
}
- ty::TyClosure(def_id, ref substs) => {
- let infcx = infer::normalizing_infer_ctxt(cx.tcx(), &cx.tcx().tables);
- let upvars = infcx.closure_upvars(def_id, substs).unwrap();
- let upvar_types = upvars.iter().map(|u| u.ty).collect::<Vec<_>>();
-
+ ty::TyClosure(_, ref substs) => {
prepare_tuple_metadata(cx,
t,
- &upvar_types[..],
+ &substs.upvar_tys,
unique_type_id,
usage_site_span).finalize(cx)
}
ty::TyBareFn(_, ref barefnty) => {
(cx.tcx().erase_late_bound_regions(&barefnty.sig), barefnty.abi)
}
- ty::TyClosure(def_id, substs) => {
+ ty::TyClosure(def_id, ref substs) => {
let closure_type = cx.tcx().closure_type(def_id, substs);
(cx.tcx().erase_late_bound_regions(&closure_type.sig), closure_type.abi)
}