cleanup: convert some remaining #foo invocations to foo! form.
This commit is contained in:
parent
2b93ab5a21
commit
4e1ce014c8
@ -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 {
|
||||
|
@ -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())));
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) => {
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// xfail-test
|
||||
fn main() {
|
||||
auto s = #shell { uname -a };
|
||||
let s = shell!( uname -a );
|
||||
log(debug, s);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user