]> git.lizzy.rs Git - rust.git/commitdiff
remove mk_closure
authorJorge Aparicio <japaricious@gmail.com>
Sun, 4 Jan 2015 14:55:16 +0000 (09:55 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 22:22:15 +0000 (17:22 -0500)
src/librustc/metadata/tydecode.rs
src/librustc/middle/ty.rs
src/librustc_driver/test.rs
src/librustc_trans/trans/closure.rs
src/librustc_typeck/check/closure.rs

index 825daa7ddb94cc1582fa15414d6101447725a008..07dc13ff0d48f6e3b782bb1bbf858b57f935359c 100644 (file)
@@ -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),
index bc6ac8abe38f536c765eab7453c8c03e16282b63..715151434f29d58b6b35ba7eab7f04c51d773ee5 100644 (file)
@@ -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> {
index ab41ade576a5898c4dd3f3dda73a54ff672974d4..b1e65dce6045a592200f44e9d29cd5f760e09447 100644 (file)
@@ -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));
     })
 }
 
index cb0d2f3edd4d69f6afa49028b984894739335d02..a8363699db8e3b071ac5931aeca59b94d1cfcc1c 100644 (file)
@@ -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)));
 
index 1368b3325a57f50b38909f7f8839d184706dd3c6..fb15a55d83420543bdf3c9e64a49fc7b5830e562 100644 (file)
@@ -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);