remove mk_closure
This commit is contained in:
parent
4e9c50e081
commit
8a6d7a68b1
@ -506,9 +506,6 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
|
||||
st.pos = st.pos + 1u;
|
||||
return ty::mk_tup(tcx, params);
|
||||
}
|
||||
'f' => {
|
||||
return ty::mk_closure(tcx, parse_closure_ty_(st, conv));
|
||||
}
|
||||
'F' => {
|
||||
let def_id = parse_def_(st, NominalType, conv);
|
||||
return ty::mk_bare_fn(tcx, Some(def_id),
|
||||
|
@ -2738,10 +2738,6 @@ pub fn mk_nil<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
|
||||
mk_tup(cx, Vec::new())
|
||||
}
|
||||
|
||||
pub fn mk_closure<'tcx>(cx: &ctxt<'tcx>, fty: ClosureTy<'tcx>) -> Ty<'tcx> {
|
||||
panic!("stub");
|
||||
}
|
||||
|
||||
pub fn mk_bare_fn<'tcx>(cx: &ctxt<'tcx>,
|
||||
opt_def_id: Option<ast::DefId>,
|
||||
fty: &'tcx BareFnTy<'tcx>) -> Ty<'tcx> {
|
||||
|
@ -277,26 +277,6 @@ pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
|
||||
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[]))
|
||||
@ -780,19 +760,6 @@ fn escaping() {
|
||||
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));
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,6 @@ pub fn trans_unboxed_closure<'blk, 'tcx>(
|
||||
// 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());
|
||||
@ -543,8 +542,8 @@ pub fn trans_unboxed_closure<'blk, 'tcx>(
|
||||
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)));
|
||||
|
||||
|
@ -316,7 +316,7 @@ fn check_boxed_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
|
||||
abi::Rust,
|
||||
expected_sig);
|
||||
let fn_sig = fn_ty.sig.clone();
|
||||
let fty = ty::mk_closure(tcx, fn_ty);
|
||||
let fty = panic!("stub");
|
||||
debug!("check_expr_fn fty={}", fcx.infcx().ty_to_string(fty));
|
||||
|
||||
fcx.write_ty(expr.id, fty);
|
||||
|
Loading…
Reference in New Issue
Block a user