diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-11-07 13:41:02 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-11-13 08:57:31 -0800 |
| commit | 4e1ce014c831974738af62dce4fd699c20a001ff (patch) | |
| tree | 51678479fe275880834402c07a1418b1d0ea0d15 | |
| parent | 2b93ab5a210066abab30e46e54e999fadbcf5e70 (diff) | |
| download | rust-4e1ce014c831974738af62dce4fd699c20a001ff.tar.gz rust-4e1ce014c831974738af62dce4fd699c20a001ff.zip | |
cleanup: convert some remaining #foo invocations to foo! form.
| -rw-r--r-- | src/librustc/front/intrinsic.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/liveness.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/ty.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/check.rs | 2 | ||||
| -rw-r--r-- | src/libstd/serialization.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/core-std.rs | 10 | ||||
| -rw-r--r-- | src/test/bench/msgsend-ring-pipes.rs | 9 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide-pipes.rs | 2 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-2823.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2904.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/macro-2.rs | 7 | ||||
| -rw-r--r-- | src/test/run-pass/syntax-extension-shell.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/syntax-extension-source-utils.rs | 2 |
15 files changed, 22 insertions, 34 deletions
diff --git a/src/librustc/front/intrinsic.rs b/src/librustc/front/intrinsic.rs index 2a87f089c8d..9a9229ebaef 100644 --- a/src/librustc/front/intrinsic.rs +++ b/src/librustc/front/intrinsic.rs @@ -1,4 +1,4 @@ -// NB: this file is #include_str'ed into the compiler, re-parsed +// NB: this file is include_str!'ed into the compiler, re-parsed // and injected into each crate the compiler builds. Keep it small. mod intrinsic { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index ec7c2ffc6f1..0790208244e 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1536,7 +1536,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) { // Probably a bad error message (what's an rvalue?) // but I can't think of anything better self.tcx.sess.span_err(arg_expr.span, - #fmt("Move mode argument must be an rvalue: try \ + fmt!("Move mode argument must be an rvalue: try \ (move %s) instead", expr_to_str(*arg_expr, self.tcx.sess.intr()))); } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index e7cf5fa8ad8..efa89e21739 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1533,7 +1533,7 @@ fn subst(cx: ctxt, cx, typ, |r| match r { re_bound(br_self) => substs.self_r.expect( - #fmt("ty::subst: \ + fmt!("ty::subst: \ Reference to self region when given substs with no \ self region, ty = %s", ty_to_str(cx, typ))), _ => r diff --git a/src/librustc/middle/typeck/check.rs b/src/librustc/middle/typeck/check.rs index 3f96f5af1a1..80cc61a8d07 100644 --- a/src/librustc/middle/typeck/check.rs +++ b/src/librustc/middle/typeck/check.rs @@ -2430,7 +2430,7 @@ fn check_enum_variants(ccx: @crate_ctxt, } Err(err) => { ccx.tcx.sess.span_err(e.span, - #fmt("expected constant: %s", err)); + fmt!("expected constant: %s", err)); } } diff --git a/src/libstd/serialization.rs b/src/libstd/serialization.rs index 1b2cd0aaa3d..93d025a7786 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -376,7 +376,7 @@ pub impl<D: Deserializer, T: Deserializable<D>> Option<T>: Deserializable<D> { match i { 0 => None, 1 => Some(d.read_enum_variant_arg(0u, || deserialize(d))), - _ => fail(#fmt("Bad variant for option: %u", i)) + _ => fail(fmt!("Bad variant for option: %u", i)) } } } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 9b41d90e6d0..45c8fd76e4f 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -57,7 +57,7 @@ fn expand_mod(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body) fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { let args = get_mac_args(cx, sp, arg, 1u, option::Some(1u), ~"include"); - let file = expr_to_str(cx, args[0], ~"#include_str requires a string"); + let file = expr_to_str(cx, args[0], ~"include_str! requires a string"); let p = parse::new_parser_from_file(cx.parse_sess(), cx.cfg(), &res_rel_file(cx, sp, &Path(file)), parse::parser::SOURCE_FILE); @@ -68,7 +68,7 @@ fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { let args = get_mac_args(cx,sp,arg,1u,option::Some(1u),~"include_str"); - let file = expr_to_str(cx, args[0], ~"#include_str requires a string"); + let file = expr_to_str(cx, args[0], ~"include_str! requires a string"); let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file))); match res { @@ -85,7 +85,7 @@ fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { let args = get_mac_args(cx,sp,arg,1u,option::Some(1u),~"include_bin"); - let file = expr_to_str(cx, args[0], ~"#include_bin requires a string"); + let file = expr_to_str(cx, args[0], ~"include_bin! requires a string"); match io::read_whole_file(&res_rel_file(cx, sp, &Path(file))) { result::Ok(src) => { diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 6f90a2c99e8..3cc1163eb22 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -8,14 +8,12 @@ use std::map::{Map, HashMap}; use io::{Reader, ReaderUtil}; +macro_rules! bench ( + ($id:ident) => (maybe_run_test(argv, stringify!($id), $id)) +) + fn main() { let argv = os::args(); - #macro[ - [#bench[id], - maybe_run_test(argv, #stringify(id), id) - ] - ]; - let tests = vec::view(argv, 1, argv.len()); bench!(shift_push); diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index 636fef53732..da49b006cd9 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -18,12 +18,9 @@ proto! ring ( } ) -fn macros() { - #macro[ - [#move_out[x], - unsafe { let y = move *ptr::addr_of(&x); move y }] - ]; -} +macro_rules! move_out ( + ($x:expr) => { unsafe { let y = move *ptr::addr_of(&$x); move y } } +) fn thread_ring(i: uint, count: uint, diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 3a3c609853b..c395ff39430 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -132,7 +132,7 @@ fn main() { let args = os::args(); let rdr = if os::getenv(~"RUST_BENCH").is_some() { // FIXME: Using this compile-time env variable is a crummy way to - // get to this massive data set, but #include_bin chokes on it (#2598) + // get to this massive data set, but include_bin! chokes on it (#2598) let path = Path(env!("CFG_SRC_DIR")) .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data")); result::get(&io::file_reader(&path)) diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index e4373d55c17..a4ff9ef1640 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -129,7 +129,7 @@ fn main() { let args = os::args(); let rdr = if os::getenv(~"RUST_BENCH").is_some() { // FIXME: Using this compile-time env variable is a crummy way to - // get to this massive data set, but #include_bin chokes on it (#2598) + // get to this massive data set, but include_bin! chokes on it (#2598) let path = Path(env!("CFG_SRC_DIR")) .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data")); result::get(&io::file_reader(&path)) diff --git a/src/test/compile-fail/issue-2823.rs b/src/test/compile-fail/issue-2823.rs index fd2c1758458..67e028dcd46 100644 --- a/src/test/compile-fail/issue-2823.rs +++ b/src/test/compile-fail/issue-2823.rs @@ -1,12 +1,12 @@ struct C { x: int, drop { - #error("dropping: %?", self.x); + error!("dropping: %?", self.x); } } fn main() { let c = C{ x: 2}; let d = copy c; //~ ERROR copying a noncopyable value - #error("%?", d.x); + error!("%?", d.x); } \ No newline at end of file diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 5cc39f4d683..132fd47636b 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -71,7 +71,7 @@ mod test { #[test] fn read_simple_board() { - let s = #include_str("./maps/contest1.map"); + let s = include_str!("./maps/contest1.map"); io::with_str_reader(s, read_board_grid) } } diff --git a/src/test/run-pass/macro-2.rs b/src/test/run-pass/macro-2.rs index 31f6d60df23..595583d2cef 100644 --- a/src/test/run-pass/macro-2.rs +++ b/src/test/run-pass/macro-2.rs @@ -1,13 +1,6 @@ // xfail-pretty - token trees can't pretty print fn main() { - #macro[[#mylambda[x, body], - { - fn f(x: int) -> int { return body; } - f - }]]; - - assert (mylambda!(y, y * 2)(8) == 16); macro_rules! mylambda_tt( ($x:ident, $body:expr) => { diff --git a/src/test/run-pass/syntax-extension-shell.rs b/src/test/run-pass/syntax-extension-shell.rs index 6ec80db8d55..2507057c648 100644 --- a/src/test/run-pass/syntax-extension-shell.rs +++ b/src/test/run-pass/syntax-extension-shell.rs @@ -1,5 +1,5 @@ // xfail-test fn main() { - auto s = #shell { uname -a }; + let s = shell!( uname -a ); log(debug, s); } diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index 7afb74fa121..2a6b5d644f1 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -1,5 +1,5 @@ // This test is brittle! -// xfail-pretty - the pretty tests lose path information, breaking #include +// xfail-pretty - the pretty tests lose path information, breaking include! #[legacy_exports]; mod m1 { |
