libregex_macros: use unboxed closures

This commit is contained in:
Jorge Aparicio
2014-12-07 12:36:42 -05:00
parent 879ebce6a4
commit b44b5da8c2
+5 -3
View File
@@ -19,6 +19,7 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(plugin_registrar, quote)]
#![feature(unboxed_closures)]
extern crate regex;
extern crate syntax;
@@ -601,9 +602,10 @@ fn wild_arm_expr(&self, body: P<ast::Expr>) -> ast::Arm {
// Converts `xs` to a `[x1, x2, .., xN]` expression by calling `to_expr`
// on each element in `xs`.
fn vec_expr<T, It: Iterator<T>>(&self, xs: It,
to_expr: |&ExtCtxt, T| -> P<ast::Expr>)
-> P<ast::Expr> {
fn vec_expr<T, It, F>(&self, xs: It, mut to_expr: F) -> P<ast::Expr> where
It: Iterator<T>,
F: FnMut(&ExtCtxt, T) -> P<ast::Expr>,
{
let exprs = xs.map(|x| to_expr(self.cx, x)).collect();
self.cx.expr_vec(self.sp, exprs)
}