Skip to content

Commit a9cc506

Browse files
committed
Change syntax extension syntax: #m[...] -> m!{...}.
1 parent 650fb06 commit a9cc506

File tree

365 files changed

+2760
-2759
lines changed

Some content is hidden

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

365 files changed

+2760
-2759
lines changed

src/cargo/cargo.rs

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

src/compiletest/compiletest.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ fn parse_config(args: ~[~str]) -> config {
6868

6969
fn log_config(config: config) {
7070
let c = config;
71-
logv(c, #fmt["configuration:"]);
72-
logv(c, #fmt["compile_lib_path: %s", config.compile_lib_path]);
73-
logv(c, #fmt["run_lib_path: %s", config.run_lib_path]);
74-
logv(c, #fmt["rustc_path: %s", config.rustc_path]);
75-
logv(c, #fmt["src_base: %s", config.src_base]);
76-
logv(c, #fmt["build_base: %s", config.build_base]);
77-
logv(c, #fmt["stage_id: %s", config.stage_id]);
78-
logv(c, #fmt["mode: %s", mode_str(config.mode)]);
79-
logv(c, #fmt["run_ignored: %b", config.run_ignored]);
80-
logv(c, #fmt["filter: %s", opt_str(config.filter)]);
81-
logv(c, #fmt["runtool: %s", opt_str(config.runtool)]);
82-
logv(c, #fmt["rustcflags: %s", opt_str(config.rustcflags)]);
83-
logv(c, #fmt["verbose: %b", config.verbose]);
84-
logv(c, #fmt["\n"]);
71+
logv(c, fmt!{"configuration:"});
72+
logv(c, fmt!{"compile_lib_path: %s", config.compile_lib_path});
73+
logv(c, fmt!{"run_lib_path: %s", config.run_lib_path});
74+
logv(c, fmt!{"rustc_path: %s", config.rustc_path});
75+
logv(c, fmt!{"src_base: %s", config.src_base});
76+
logv(c, fmt!{"build_base: %s", config.build_base});
77+
logv(c, fmt!{"stage_id: %s", config.stage_id});
78+
logv(c, fmt!{"mode: %s", mode_str(config.mode)});
79+
logv(c, fmt!{"run_ignored: %b", config.run_ignored});
80+
logv(c, fmt!{"filter: %s", opt_str(config.filter)});
81+
logv(c, fmt!{"runtool: %s", opt_str(config.runtool)});
82+
logv(c, fmt!{"rustcflags: %s", opt_str(config.rustcflags)});
83+
logv(c, fmt!{"verbose: %b", config.verbose});
84+
logv(c, fmt!{"\n"});
8585
}
8686

8787
fn opt_str(maybestr: option<~str>) -> ~str {
@@ -134,11 +134,11 @@ fn test_opts(config: config) -> test::test_opts {
134134
}
135135
136136
fn make_tests(config: config) -> ~[test::test_desc] {
137-
#debug("making tests from %s", config.src_base);
137+
debug!{"making tests from %s", config.src_base};
138138
let mut tests = ~[];
139139
for os::list_dir_path(config.src_base).each |file| {
140140
let file = file;
141-
#debug("inspecting file %s", file);
141+
debug!{"inspecting file %s", file};
142142
if is_test(config, file) {
143143
vec::push(tests, make_test(config, file))
144144
}
@@ -177,7 +177,7 @@ fn make_test(config: config, testfile: ~str) ->
177177
}
178178

179179
fn make_test_name(config: config, testfile: ~str) -> ~str {
180-
#fmt["[%s] %s", mode_str(config.mode), testfile]
180+
fmt!{"[%s] %s", mode_str(config.mode), testfile}
181181
}
182182

183183
fn make_test_closure(config: config, testfile: ~str) -> test::test_fn {

src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
4747
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
4848
let msg = str::slice(line, idx, len);
4949

50-
#debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
50+
debug!{"line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg};
5151

5252
ret ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
5353
}

src/compiletest/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> {
110110
alt strs.len() {
111111
1u { (strs[0], ~"") }
112112
2u { (strs[0], strs[1]) }
113-
n { fail #fmt["Expected 1 or 2 strings, not %u", n]; }
113+
n { fail fmt!{"Expected 1 or 2 strings, not %u", n}; }
114114
}
115115
}
116116
}
@@ -139,7 +139,7 @@ fn parse_name_value_directive(line: ~str,
139139
option::some(colon) {
140140
let value = str::slice(line, colon + str::len(keycolon),
141141
str::len(line));
142-
#debug("%s: %s", directive, value);
142+
debug!{"%s: %s", directive, value};
143143
option::some(value)
144144
}
145145
option::none { option::none }

src/compiletest/runtest.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn run(config: config, testfile: ~str) {
1616
// We're going to be dumping a lot of info. Start on a new line.
1717
io::stdout().write_str(~"\n\n");
1818
}
19-
#debug("running %s", testfile);
19+
debug!{"running %s", testfile};
2020
let props = load_props(testfile);
2121
alt config.mode {
2222
mode_compile_fail { run_cfail_test(config, props, testfile); }
@@ -68,8 +68,8 @@ fn check_correct_failure_status(procres: procres) {
6868
const rust_err: int = 101;
6969
if procres.status != rust_err {
7070
fatal_procres(
71-
#fmt("failure produced the wrong error code: %d",
72-
procres.status),
71+
fmt!{"failure produced the wrong error code: %d",
72+
procres.status},
7373
procres);
7474
}
7575
}
@@ -96,11 +96,11 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
9696

9797
let mut round = 0;
9898
while round < rounds {
99-
logv(config, #fmt["pretty-printing round %d", round]);
99+
logv(config, fmt!{"pretty-printing round %d", round});
100100
let procres = print_source(config, testfile, srcs[round]);
101101

102102
if procres.status != 0 {
103-
fatal_procres(#fmt["pretty-printing failed in round %d", round],
103+
fatal_procres(fmt!{"pretty-printing failed in round %d", round},
104104
procres);
105105
}
106106

@@ -151,7 +151,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
151151
if expected != actual {
152152
error(~"pretty-printed source does not match expected source");
153153
let msg =
154-
#fmt["\n\
154+
fmt!{"\n\
155155
expected:\n\
156156
------------------------------------------\n\
157157
%s\n\
@@ -161,7 +161,7 @@ actual:\n\
161161
%s\n\
162162
------------------------------------------\n\
163163
\n",
164-
expected, actual];
164+
expected, actual};
165165
io::stdout().write_str(msg);
166166
fail;
167167
}
@@ -201,10 +201,10 @@ fn check_error_patterns(props: test_props,
201201
let mut done = false;
202202
for str::split_char(procres.stderr, '\n').each |line| {
203203
if str::contains(line, next_err_pat) {
204-
#debug("found error pattern %s", next_err_pat);
204+
debug!{"found error pattern %s", next_err_pat};
205205
next_err_idx += 1u;
206206
if next_err_idx == vec::len(props.error_patterns) {
207-
#debug("found all error patterns");
207+
debug!{"found all error patterns"};
208208
done = true;
209209
break;
210210
}
@@ -217,11 +217,11 @@ fn check_error_patterns(props: test_props,
217217
vec::slice(props.error_patterns, next_err_idx,
218218
vec::len(props.error_patterns));
219219
if vec::len(missing_patterns) == 1u {
220-
fatal_procres(#fmt["error pattern '%s' not found!",
221-
missing_patterns[0]], procres);
220+
fatal_procres(fmt!{"error pattern '%s' not found!",
221+
missing_patterns[0]}, procres);
222222
} else {
223223
for missing_patterns.each |pattern| {
224-
error(#fmt["error pattern '%s' not found!", pattern]);
224+
error(fmt!{"error pattern '%s' not found!", pattern});
225225
}
226226
fatal_procres(~"multiple error patterns not found", procres);
227227
}
@@ -240,7 +240,7 @@ fn check_expected_errors(expected_errors: ~[errors::expected_error],
240240
}
241241

242242
let prefixes = vec::map(expected_errors, |ee| {
243-
#fmt("%s:%u:", testfile, ee.line)
243+
fmt!{"%s:%u:", testfile, ee.line}
244244
});
245245

246246
// Scan and extract our error/warning messages,
@@ -253,8 +253,8 @@ fn check_expected_errors(expected_errors: ~[errors::expected_error],
253253
let mut was_expected = false;
254254
for vec::eachi(expected_errors) |i, ee| {
255255
if !found_flags[i] {
256-
#debug["prefix=%s ee.kind=%s ee.msg=%s line=%s",
257-
prefixes[i], ee.kind, ee.msg, line];
256+
debug!{"prefix=%s ee.kind=%s ee.msg=%s line=%s",
257+
prefixes[i], ee.kind, ee.msg, line};
258258
if (str::starts_with(line, prefixes[i]) &&
259259
str::contains(line, ee.kind) &&
260260
str::contains(line, ee.msg)) {
@@ -272,16 +272,16 @@ fn check_expected_errors(expected_errors: ~[errors::expected_error],
272272

273273
if !was_expected && (str::contains(line, ~"error") ||
274274
str::contains(line, ~"warning")) {
275-
fatal_procres(#fmt["unexpected error pattern '%s'!", line],
275+
fatal_procres(fmt!{"unexpected error pattern '%s'!", line},
276276
procres);
277277
}
278278
}
279279

280280
for uint::range(0u, vec::len(found_flags)) |i| {
281281
if !found_flags[i] {
282282
let ee = expected_errors[i];
283-
fatal_procres(#fmt["expected %s on line %u not found: %s",
284-
ee.kind, ee.line, ee.msg], procres);
283+
fatal_procres(fmt!{"expected %s on line %u not found: %s",
284+
ee.kind, ee.line, ee.msg}, procres);
285285
}
286286
}
287287
}
@@ -330,7 +330,7 @@ fn compose_and_run_compiler(
330330
config.compile_lib_path, option::none);
331331
if auxres.status != 0 {
332332
fatal_procres(
333-
#fmt["auxiliary build of %s failed to compile: ", abs_ab],
333+
fmt!{"auxiliary build of %s failed to compile: ", abs_ab},
334334
auxres);
335335
}
336336
}
@@ -342,7 +342,7 @@ fn compose_and_run_compiler(
342342
fn ensure_dir(path: path) {
343343
if os::path_is_dir(path) { ret; }
344344
if !os::make_dir(path, 0x1c0i32) {
345-
fail #fmt("can't make dir %s", path);
345+
fail fmt!{"can't make dir %s", path};
346346
}
347347
}
348348

@@ -414,7 +414,7 @@ fn program_output(config: config, testfile: ~str, lib_path: ~str, prog: ~str,
414414
let cmdline =
415415
{
416416
let cmdline = make_cmdline(lib_path, prog, args);
417-
logv(config, #fmt["executing %s", cmdline]);
417+
logv(config, fmt!{"executing %s", cmdline});
418418
cmdline
419419
};
420420
let res = procsrv::run(lib_path, prog, args, env, input);
@@ -430,19 +430,19 @@ fn program_output(config: config, testfile: ~str, lib_path: ~str, prog: ~str,
430430
#[cfg(target_os = "macos")]
431431
#[cfg(target_os = "freebsd")]
432432
fn make_cmdline(_libpath: ~str, prog: ~str, args: ~[~str]) -> ~str {
433-
#fmt["%s %s", prog, str::connect(args, ~" ")]
433+
fmt!{"%s %s", prog, str::connect(args, ~" ")}
434434
}
435435
436436
#[cfg(target_os = "win32")]
437437
fn make_cmdline(libpath: ~str, prog: ~str, args: ~[~str]) -> ~str {
438-
#fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog,
439-
str::connect(args, ~" ")]
438+
fmt!{"%s %s %s", lib_path_cmd_prefix(libpath), prog,
439+
str::connect(args, ~" ")}
440440
}
441441
442442
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
443443
// for diagnostic purposes
444444
fn lib_path_cmd_prefix(path: ~str) -> ~str {
445-
#fmt["%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)]
445+
fmt!{"%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)}
446446
}
447447

448448
fn dump_output(config: config, testfile: ~str, out: ~str, err: ~str) {
@@ -475,13 +475,13 @@ fn output_testname(testfile: ~str) -> ~str {
475475
fn output_base_name(config: config, testfile: ~str) -> ~str {
476476
let base = config.build_base;
477477
let filename = output_testname(testfile);
478-
#fmt["%s%s.%s", base, filename, config.stage_id]
478+
fmt!{"%s%s.%s", base, filename, config.stage_id}
479479
}
480480

481481
fn maybe_dump_to_stdout(config: config, out: ~str, err: ~str) {
482482
if config.verbose {
483-
let sep1 = #fmt["------%s------------------------------", ~"stdout"];
484-
let sep2 = #fmt["------%s------------------------------", ~"stderr"];
483+
let sep1 = fmt!{"------%s------------------------------", ~"stdout"};
484+
let sep2 = fmt!{"------%s------------------------------", ~"stderr"};
485485
let sep3 = ~"------------------------------------------";
486486
io::stdout().write_line(sep1);
487487
io::stdout().write_line(out);
@@ -491,13 +491,13 @@ fn maybe_dump_to_stdout(config: config, out: ~str, err: ~str) {
491491
}
492492
}
493493
494-
fn error(err: ~str) { io::stdout().write_line(#fmt["\nerror: %s", err]); }
494+
fn error(err: ~str) { io::stdout().write_line(fmt!{"\nerror: %s", err}); }
495495
496496
fn fatal(err: ~str) -> ! { error(err); fail; }
497497
498498
fn fatal_procres(err: ~str, procres: procres) -> ! {
499499
let msg =
500-
#fmt["\n\
500+
fmt!{"\n\
501501
error: %s\n\
502502
command: %s\n\
503503
stdout:\n\
@@ -509,7 +509,7 @@ stderr:\n\
509509
%s\n\
510510
------------------------------------------\n\
511511
\n",
512-
err, procres.cmdline, procres.stdout, procres.stderr];
512+
err, procres.cmdline, procres.stdout, procres.stderr};
513513
io::stdout().write_str(msg);
514514
fail;
515515
}

src/compiletest/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn make_new_path(path: ~str) -> ~str {
99
// maintain the current value while adding our own
1010
alt getenv(lib_path_env_var()) {
1111
option::some(curr) {
12-
#fmt["%s%s%s", path, path_div(), curr]
12+
fmt!{"%s%s%s", path, path_div(), curr}
1313
}
1414
option::none { path }
1515
}

src/fuzzer/ast_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ fn main() {
2626
assert (!vec_equal(~[5, 5], ~[4, 5], builtin_equal_int));
2727
assert (vec_equal(~[5, 5], ~[5, 5], builtin_equal_int));
2828

29-
#error("Pass");
29+
error!{"Pass"};
3030
}

0 commit comments

Comments
 (0)