Skip to content

Commit 015c0fc

Browse files
author
Jorge Aparicio
committed
librustc_driver: use unboxed closures
1 parent 521a6e6 commit 015c0fc

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/librustc_driver/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
2626
#![feature(slicing_syntax, unsafe_destructor)]
2727
#![feature(rustc_diagnostic_macros)]
28+
#![feature(unboxed_closures)]
2829

2930
extern crate arena;
3031
extern crate flate;

src/librustc_driver/pretty.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<UserIdentifie
9999

100100
impl PpSourceMode {
101101
/// Constructs a `PrinterSupport` object and passes it to `f`.
102-
fn call_with_pp_support<'tcx, A, B>(&self,
103-
sess: Session,
104-
ast_map: Option<ast_map::Map<'tcx>>,
105-
type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
106-
id: String,
107-
payload: B,
108-
f: |&PrinterSupport, B| -> A) -> A {
102+
fn call_with_pp_support<'tcx, A, B, F>(&self,
103+
sess: Session,
104+
ast_map: Option<ast_map::Map<'tcx>>,
105+
type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
106+
id: String,
107+
payload: B,
108+
f: F) -> A where
109+
F: FnOnce(&PrinterSupport, B) -> A,
110+
{
109111
match *self {
110112
PpmNormal | PpmExpanded => {
111113
let annotation = NoAnn { sess: sess, ast_map: ast_map };

src/librustc_driver/test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, uint) {
9393
(box ExpectErrorEmitter { messages: v } as Box<Emitter+Send>, msgs.len())
9494
}
9595

96-
fn test_env(source_string: &str,
97-
(emitter, expected_err_count): (Box<Emitter+Send>, uint),
98-
body: |Env|) {
96+
fn test_env<F>(source_string: &str,
97+
(emitter, expected_err_count): (Box<Emitter+Send>, uint),
98+
body: F) where
99+
F: FnOnce(Env),
100+
{
99101
let mut options =
100102
config::basic_options();
101103
options.debugging_opts |= config::VERBOSE;

0 commit comments

Comments
 (0)