Skip to content

Commit bb45ecd

Browse files
committed
---
yaml --- r: 93913 b: refs/heads/try c: 8ceb374 h: refs/heads/master i: 93911: f9f4fa5 v: v3
1 parent 4a0ac15 commit bb45ecd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1312
-1348
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: efc512362b0f2ae200ef079e3566c6b158a857cc
5+
refs/heads/try: 8ceb374ab783c6417b60867e7f34bebe997936ac
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/back/link.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ pub fn WriteOutputFile(
7272
Output: &Path,
7373
FileType: lib::llvm::FileType) {
7474
unsafe {
75-
do Output.with_c_str |Output| {
75+
Output.with_c_str(|Output| {
7676
let result = llvm::LLVMRustWriteOutputFile(
7777
Target, PM, M, Output, FileType);
7878
if !result {
7979
llvm_err(sess, ~"Could not write output");
8080
}
81-
}
81+
})
8282
}
8383
}
8484

@@ -130,12 +130,12 @@ pub mod jit {
130130
for cratepath in r.iter() {
131131
debug!("linking: {}", cratepath.display());
132132

133-
do cratepath.with_c_str |buf_t| {
133+
cratepath.with_c_str(|buf_t| {
134134
if !llvm::LLVMRustLoadCrate(manager, buf_t) {
135135
llvm_err(sess, ~"Could not link");
136136
}
137137
debug!("linked: {}", cratepath.display());
138-
}
138+
})
139139
}
140140

141141
// We custom-build a JIT execution engine via some rust wrappers
@@ -149,9 +149,9 @@ pub mod jit {
149149
// Next, we need to get a handle on the _rust_main function by
150150
// looking up it's corresponding ValueRef and then requesting that
151151
// the execution engine compiles the function.
152-
let fun = do "_rust_main".with_c_str |entry| {
152+
let fun = "_rust_main".with_c_str(|entry| {
153153
llvm::LLVMGetNamedFunction(m, entry)
154-
};
154+
});
155155
if fun.is_null() {
156156
llvm::LLVMDisposeExecutionEngine(ee);
157157
llvm::LLVMContextDispose(c);
@@ -248,9 +248,9 @@ pub mod write {
248248
llvm::LLVMInitializeMipsAsmParser();
249249

250250
if sess.opts.save_temps {
251-
do output.with_extension("no-opt.bc").with_c_str |buf| {
251+
output.with_extension("no-opt.bc").with_c_str(|buf| {
252252
llvm::LLVMWriteBitcodeToFile(llmod, buf);
253-
}
253+
})
254254
}
255255

256256
configure_llvm(sess);
@@ -263,9 +263,9 @@ pub mod write {
263263
};
264264
let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;
265265

266-
let tm = do sess.targ_cfg.target_strs.target_triple.with_c_str |T| {
267-
do sess.opts.target_cpu.with_c_str |CPU| {
268-
do sess.opts.target_feature.with_c_str |Features| {
266+
let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
267+
sess.opts.target_cpu.with_c_str(|CPU| {
268+
sess.opts.target_feature.with_c_str(|Features| {
269269
llvm::LLVMRustCreateTargetMachine(
270270
T, CPU, Features,
271271
lib::llvm::CodeModelDefault,
@@ -274,9 +274,9 @@ pub mod write {
274274
true,
275275
use_softfp
276276
)
277-
}
278-
}
279-
};
277+
})
278+
})
279+
});
280280

281281
// Create the two optimizing pass managers. These mirror what clang
282282
// does, and are by populated by LLVM's default PassManagerBuilder.
@@ -288,7 +288,7 @@ pub mod write {
288288
// If we're verifying or linting, add them to the function pass
289289
// manager.
290290
let addpass = |pass: &str| {
291-
do pass.with_c_str |s| { llvm::LLVMRustAddPass(fpm, s) }
291+
pass.with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
292292
};
293293
if !sess.no_verify() { assert!(addpass("verify")); }
294294
if sess.lint_llvm() { assert!(addpass("lint")); }
@@ -300,11 +300,11 @@ pub mod write {
300300
}
301301

302302
for pass in sess.opts.custom_passes.iter() {
303-
do pass.with_c_str |s| {
303+
pass.with_c_str(|s| {
304304
if !llvm::LLVMRustAddPass(mpm, s) {
305305
sess.warn(format!("Unknown pass {}, ignoring", *pass));
306306
}
307-
}
307+
})
308308
}
309309

310310
// Finally, run the actual optimization passes
@@ -316,9 +316,9 @@ pub mod write {
316316
llvm::LLVMDisposePassManager(mpm);
317317

318318
if sess.opts.save_temps {
319-
do output.with_extension("bc").with_c_str |buf| {
319+
output.with_extension("bc").with_c_str(|buf| {
320320
llvm::LLVMWriteBitcodeToFile(llmod, buf);
321-
}
321+
})
322322
}
323323

324324
if sess.opts.jit {
@@ -337,14 +337,14 @@ pub mod write {
337337
match output_type {
338338
output_type_none => {}
339339
output_type_bitcode => {
340-
do output.with_c_str |buf| {
340+
output.with_c_str(|buf| {
341341
llvm::LLVMWriteBitcodeToFile(llmod, buf);
342-
}
342+
})
343343
}
344344
output_type_llvm_assembly => {
345-
do output.with_c_str |output| {
345+
output.with_c_str(|output| {
346346
llvm::LLVMRustPrintModule(cpm, llmod, output)
347-
}
347+
})
348348
}
349349
output_type_assembly => {
350350
WriteOutputFile(sess, tm, cpm, llmod, output, lib::llvm::AssemblyFile);
@@ -415,9 +415,9 @@ pub mod write {
415415
add(*arg);
416416
}
417417

418-
do llvm_args.as_imm_buf |p, len| {
418+
llvm_args.as_imm_buf(|p, len| {
419419
llvm::LLVMRustSetLLVMOptions(len as c_int, p);
420-
}
420+
})
421421
}
422422

423423
unsafe fn populate_llvm_passes(fpm: lib::llvm::PassManagerRef,
@@ -736,7 +736,7 @@ pub fn sanitize(s: &str) -> ~str {
736736

737737
_ => {
738738
let mut tstr = ~"";
739-
do char::escape_unicode(c) |c| { tstr.push_char(c); }
739+
char::escape_unicode(c, |c| tstr.push_char(c));
740740
result.push_char('$');
741741
result.push_str(tstr.slice_from(1));
742742
}

branches/try/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ pub fn build_configuration(sess: Session) ->
123123
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
124124
fn parse_cfgspecs(cfgspecs: ~[~str], demitter: @diagnostic::Emitter)
125125
-> ast::CrateConfig {
126-
do cfgspecs.move_iter().map |s| {
126+
cfgspecs.move_iter().map(|s| {
127127
let sess = parse::new_parse_sess(Some(demitter));
128128
parse::parse_meta_from_source_str(@"cfgspec", s.to_managed(), ~[], sess)
129-
}.collect::<ast::CrateConfig>()
129+
}).collect::<ast::CrateConfig>()
130130
}
131131

132132
pub enum input {

branches/try/src/librustc/front/config.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ struct Context<'self> {
2020
// any items that do not belong in the current configuration
2121
pub fn strip_unconfigured_items(crate: ast::Crate) -> ast::Crate {
2222
let config = crate.config.clone();
23-
do strip_items(crate) |attrs| {
24-
in_cfg(config, attrs)
25-
}
23+
strip_items(crate, |attrs| in_cfg(config, attrs))
2624
}
2725

2826
impl<'self> fold::ast_fold for Context<'self> {
@@ -68,14 +66,12 @@ fn filter_view_item<'r>(cx: &Context, view_item: &'r ast::view_item)
6866
}
6967

7068
fn fold_mod(cx: &Context, m: &ast::_mod) -> ast::_mod {
71-
let filtered_items = do m.items.iter().filter_map |a| {
69+
let filtered_items = m.items.iter().filter_map(|a| {
7270
filter_item(cx, *a).and_then(|x| cx.fold_item(x))
73-
}.collect();
74-
let filtered_view_items = do m.view_items.iter().filter_map |a| {
75-
do filter_view_item(cx, a).map |x| {
76-
cx.fold_view_item(x)
77-
}
78-
}.collect();
71+
}).collect();
72+
let filtered_view_items = m.view_items.iter().filter_map(|a| {
73+
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
74+
}).collect();
7975
ast::_mod {
8076
view_items: filtered_view_items,
8177
items: filtered_items
@@ -96,11 +92,9 @@ fn fold_foreign_mod(cx: &Context, nm: &ast::foreign_mod) -> ast::foreign_mod {
9692
.iter()
9793
.filter_map(|a| filter_foreign_item(cx, *a))
9894
.collect();
99-
let filtered_view_items = do nm.view_items.iter().filter_map |a| {
100-
do filter_view_item(cx, a).map |x| {
101-
cx.fold_view_item(x)
102-
}
103-
}.collect();
95+
let filtered_view_items = nm.view_items.iter().filter_map(|a| {
96+
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
97+
}).collect();
10498
ast::foreign_mod {
10599
abis: nm.abis,
106100
view_items: filtered_view_items,
@@ -147,12 +141,12 @@ fn filter_stmt(cx: &Context, stmt: @ast::Stmt) -> Option<@ast::Stmt> {
147141
}
148142

149143
fn fold_block(cx: &Context, b: &ast::Block) -> ast::Block {
150-
let resulting_stmts = do b.stmts.iter().filter_map |a| {
144+
let resulting_stmts = b.stmts.iter().filter_map(|a| {
151145
filter_stmt(cx, *a).and_then(|stmt| cx.fold_stmt(stmt))
152-
}.collect();
153-
let filtered_view_items = do b.view_items.iter().filter_map |a| {
146+
}).collect();
147+
let filtered_view_items = b.view_items.iter().filter_map(|a| {
154148
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
155-
}.collect();
149+
}).collect();
156150
ast::Block {
157151
view_items: filtered_view_items,
158152
stmts: resulting_stmts,

branches/try/src/librustc/front/test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ impl fold::ast_fold for TestHarnessGenerator {
118118
fn nomain(cx: @mut TestCtxt, item: @ast::item) -> @ast::item {
119119
if !*cx.sess.building_library {
120120
@ast::item {
121-
attrs: do item.attrs.iter().filter_map |attr| {
121+
attrs: item.attrs.iter().filter_map(|attr| {
122122
if "main" != attr.name() {
123123
Some(*attr)
124124
} else {
125125
None
126126
}
127-
}.collect(),
127+
}).collect(),
128128
.. (*item).clone()
129129
}
130130
} else {
@@ -172,10 +172,10 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
172172
fn strip_test_functions(crate: ast::Crate) -> ast::Crate {
173173
// When not compiling with --test we should not compile the
174174
// #[test] functions
175-
do config::strip_items(crate) |attrs| {
175+
config::strip_items(crate, |attrs| {
176176
!attr::contains_name(attrs, "test") &&
177177
!attr::contains_name(attrs, "bench")
178-
}
178+
})
179179
}
180180

181181
fn is_test_fn(cx: @mut TestCtxt, i: @ast::item) -> bool {
@@ -232,13 +232,13 @@ fn is_bench_fn(i: @ast::item) -> bool {
232232
}
233233

234234
fn is_ignored(cx: @mut TestCtxt, i: @ast::item) -> bool {
235-
do i.attrs.iter().any |attr| {
235+
i.attrs.iter().any(|attr| {
236236
// check ignore(cfg(foo, bar))
237237
"ignore" == attr.name() && match attr.meta_item_list() {
238238
Some(ref cfgs) => attr::test_cfg(cx.config, cfgs.iter().map(|x| *x)),
239239
None => true
240240
}
241-
}
241+
})
242242
}
243243

244244
fn should_fail(i: @ast::item) -> bool {

branches/try/src/librustc/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
261261
let odir = matches.opt_str("out-dir").map(|o| Path::new(o));
262262
let ofile = matches.opt_str("o").map(|o| Path::new(o));
263263
let cfg = build_configuration(sess);
264-
let pretty = do matches.opt_default("pretty", "normal").map |a| {
264+
let pretty = matches.opt_default("pretty", "normal").map(|a| {
265265
parse_pretty(sess, a)
266-
};
266+
});
267267
match pretty {
268268
Some::<PpMode>(ppm) => {
269269
pretty_print_input(sess, cfg, &input, ppm);
@@ -345,7 +345,7 @@ pub fn monitor(f: proc(@diagnostic::Emitter)) {
345345
task_builder.opts.stack_size = Some(STACK_SIZE);
346346
}
347347

348-
match do task_builder.try {
348+
match task_builder.try(|| {
349349
let ch = ch_capture.clone();
350350
// The 'diagnostics emitter'. Every error, warning, etc. should
351351
// go through this function.
@@ -368,7 +368,7 @@ pub fn monitor(f: proc(@diagnostic::Emitter)) {
368368
// Due reasons explain in #7732, if there was a jit execution context it
369369
// must be consumed and passed along to our parent task.
370370
back::link::jit::consume_engine()
371-
} {
371+
}) {
372372
result::Ok(_) => { /* fallthrough */ }
373373
result::Err(_) => {
374374
// Task failed without emitting a fatal diagnostic
@@ -403,9 +403,6 @@ pub fn main() {
403403

404404
pub fn main_args(args: &[~str]) -> int {
405405
let owned_args = args.to_owned();
406-
do monitor |demitter| {
407-
run_compiler(owned_args, demitter);
408-
}
409-
410-
return 0;
406+
monitor(|demitter| run_compiler(owned_args, demitter));
407+
0
411408
}

branches/try/src/librustc/lib/llvm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,9 +1844,9 @@ pub struct TargetData {
18441844
}
18451845

18461846
pub fn mk_target_data(string_rep: &str) -> TargetData {
1847-
let lltd = do string_rep.with_c_str |buf| {
1847+
let lltd = string_rep.with_c_str(|buf| {
18481848
unsafe { llvm::LLVMCreateTargetData(buf) }
1849-
};
1849+
});
18501850

18511851
TargetData {
18521852
lltd: lltd,

branches/try/src/librustc/metadata/cstore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[@str] {
159159
});
160160
}
161161

162-
let sorted = do extra::sort::merge_sort(result) |a, b| {
162+
let sorted = extra::sort::merge_sort(result, |a, b| {
163163
(a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash)
164-
};
164+
});
165165

166166
debug!("sorted:");
167167
for x in sorted.iter() {

0 commit comments

Comments
 (0)