about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-09 16:32:45 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-13 17:03:48 -0500
commit015c0fcee5779c62a6676106ccec00e2c82fefa5 (patch)
treee39ce1ab363b1d0a94bf828e05b243c94c4e1ccd
parent521a6e62b14b2e44d58972c9e28772fc9685b6d5 (diff)
downloadrust-015c0fcee5779c62a6676106ccec00e2c82fefa5.tar.gz
rust-015c0fcee5779c62a6676106ccec00e2c82fefa5.zip
librustc_driver: use unboxed closures
-rw-r--r--src/librustc_driver/lib.rs1
-rw-r--r--src/librustc_driver/pretty.rs16
-rw-r--r--src/librustc_driver/test.rs8
3 files changed, 15 insertions, 10 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 85d9646c282..d655b704053 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -25,6 +25,7 @@
 #![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
 #![feature(slicing_syntax, unsafe_destructor)]
 #![feature(rustc_diagnostic_macros)]
+#![feature(unboxed_closures)]
 
 extern crate arena;
 extern crate flate;
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index c872f831649..7ec05b6a030 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -99,13 +99,15 @@ pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<UserIdentifie
 
 impl PpSourceMode {
     /// Constructs a `PrinterSupport` object and passes it to `f`.
-    fn call_with_pp_support<'tcx, A, B>(&self,
-                                        sess: Session,
-                                        ast_map: Option<ast_map::Map<'tcx>>,
-                                        type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
-                                        id: String,
-                                        payload: B,
-                                        f: |&PrinterSupport, B| -> A) -> A {
+    fn call_with_pp_support<'tcx, A, B, F>(&self,
+                                           sess: Session,
+                                           ast_map: Option<ast_map::Map<'tcx>>,
+                                           type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
+                                           id: String,
+                                           payload: B,
+                                           f: F) -> A where
+        F: FnOnce(&PrinterSupport, B) -> A,
+    {
         match *self {
             PpmNormal | PpmExpanded => {
                 let annotation = NoAnn { sess: sess, ast_map: ast_map };
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index 9404802cb68..dda3754cf73 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -93,9 +93,11 @@ fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, uint) {
     (box ExpectErrorEmitter { messages: v } as Box<Emitter+Send>, msgs.len())
 }
 
-fn test_env(source_string: &str,
-            (emitter, expected_err_count): (Box<Emitter+Send>, uint),
-            body: |Env|) {
+fn test_env<F>(source_string: &str,
+               (emitter, expected_err_count): (Box<Emitter+Send>, uint),
+               body: F) where
+    F: FnOnce(Env),
+{
     let mut options =
         config::basic_options();
     options.debugging_opts |= config::VERBOSE;