ty::mk_tup(self.infcx.tcx, vec![ty1, ty2])
}
- pub fn t_closure(&self,
- input_tys: &[Ty<'tcx>],
- output_ty: Ty<'tcx>,
- region_bound: ty::Region)
- -> Ty<'tcx>
- {
- ty::mk_closure(self.infcx.tcx, ty::ClosureTy {
- unsafety: ast::Unsafety::Normal,
- onceness: ast::Many,
- store: ty::RegionTraitStore(region_bound, ast::MutMutable),
- bounds: ty::region_existential_bound(region_bound),
- sig: ty::Binder(ty::FnSig {
- inputs: input_tys.to_vec(),
- output: ty::FnConverging(output_ty),
- variadic: false,
- }),
- abi: abi::Rust,
- })
- }
-
pub fn t_param(&self, space: subst::ParamSpace, index: u32) -> Ty<'tcx> {
let name = format!("T{}", index);
ty::mk_param(self.infcx.tcx, space, index, token::intern(name[]))
assert!(!ty::type_has_escaping_regions(t_param));
let t_fn = env.t_fn(&[t_param], env.t_nil());
assert!(!ty::type_has_escaping_regions(t_fn));
-
- // t_fn = |&int|+'a
- let t_fn = env.t_closure(&[t_rptr_bound1], env.t_nil(), env.re_free(0, 1));
- assert!(!ty::type_has_escaping_regions(t_fn));
-
- // t_fn = |&int|+'a (where &int has depth 2)
- let t_fn = env.t_closure(&[t_rptr_bound2], env.t_nil(), env.re_free(0, 1));
- assert!(ty::type_has_escaping_regions(t_fn));
-
- // t_fn = |&int|+&int
- let t_fn = env.t_closure(&[t_rptr_bound1], env.t_nil(),
- env.re_late_bound_with_debruijn(1, ty::DebruijnIndex::new(1)));
- assert!(ty::type_has_escaping_regions(t_fn));
})
}
// of the closure expression.
let typer = NormalizingUnboxedClosureTyper::new(bcx.tcx());
let function_type = typer.unboxed_closure_type(closure_id, bcx.fcx.param_substs);
- let function_type = ty::mk_closure(bcx.tcx(), function_type);
let freevars: Vec<ty::Freevar> =
ty::with_freevars(bcx.tcx(), id, |fv| fv.iter().map(|&fv| fv).collect());
bcx.fcx.param_substs,
id,
&[],
- ty::ty_fn_ret(function_type),
- ty::ty_fn_abi(function_type),
+ function_type.sig.0.output,
+ function_type.abi,
ClosureEnv::new(freevars[],
UnboxedClosure(freevar_mode)));