]> git.lizzy.rs Git - rust.git/commitdiff
rustc_trans: replace `EnterPatterns` alias with an unboxed closure
authorJorge Aparicio <japaricious@gmail.com>
Wed, 31 Dec 2014 03:51:00 +0000 (22:51 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Thu, 1 Jan 2015 03:50:27 +0000 (22:50 -0500)
src/librustc_trans/trans/_match.rs

index 6e6b1c3406190cd9754642b980da0936b49167ef..fc68d1d3258e13391a7d44a88c274c7c2cf75ad7 100644 (file)
@@ -410,15 +410,15 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }).collect()
 }
 
-type EnterPatterns<'a, 'p> = |&[&'p ast::Pat]|: 'a -> Option<Vec<&'p ast::Pat>>;
-
-fn enter_match<'a, 'b, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
-                                       dm: &DefMap,
-                                       m: &[Match<'a, 'p, 'blk, 'tcx>],
-                                       col: uint,
-                                       val: ValueRef,
-                                       e: EnterPatterns<'b, 'p>)
-                                       -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
+fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
+                                          dm: &DefMap,
+                                          m: &[Match<'a, 'p, 'blk, 'tcx>],
+                                          col: uint,
+                                          val: ValueRef,
+                                          mut e: F)
+                                          -> Vec<Match<'a, 'p, 'blk, 'tcx>> where
+    F: FnMut(&[&'p ast::Pat]) -> Option<Vec<&'p ast::Pat>>,
+{
     debug!("enter_match(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),