diff options
| author | Tim Chevalier <catamorphism@gmail.com> | 2012-10-12 15:26:33 -0700 |
|---|---|---|
| committer | Tim Chevalier <catamorphism@gmail.com> | 2012-10-12 15:26:33 -0700 |
| commit | fe058374a94c511daf63b7d773f3b4c95e368a2a (patch) | |
| tree | d992d648999c3e5ed947fc1db4b35af08fd2f9f8 /src/libsyntax | |
| parent | 45d1cd83ab903d377f3b03fd2dc74da42100e308 (diff) | |
| parent | 1bede1f5e0012069feaf093a6287256af606ff92 (diff) | |
| download | rust-fe058374a94c511daf63b7d773f3b4c95e368a2a.tar.gz rust-fe058374a94c511daf63b7d773f3b4c95e368a2a.zip | |
Merge pull request #3746 from killerswan/nuke_fmt
Replace several common macros of the form #m[...] with m!(...)
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/env.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 7f208a3a710..2addb3d9e12 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -266,7 +266,7 @@ fn print_macro_backtrace(cm: codemap::codemap, sp: span) { let ss = option::map_default(&ei.callie.span, @~"", |span| @codemap::span_to_str(*span, cm)); print_diagnostic(*ss, note, - fmt!("in expansion of #%s", ei.callie.name)); + fmt!("in expansion of %s!", ei.callie.name)); let ss = codemap::span_to_str(ei.call_site, cm); print_diagnostic(ss, note, ~"expansion site"); print_macro_backtrace(cm, ei.call_site); diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index c106042b9a3..94bf2a43f28 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -269,21 +269,21 @@ fn get_mac_args(cx: ext_ctxt, sp: span, arg: ast::mac_arg, match max { Some(max) if ! (min <= elts_len && elts_len <= max) => { cx.span_fatal(sp, - fmt!("#%s takes between %u and %u arguments.", + fmt!("%s! takes between %u and %u arguments.", name, min, max)); } None if ! (min <= elts_len) => { - cx.span_fatal(sp, fmt!("#%s needs at least %u arguments.", + cx.span_fatal(sp, fmt!("%s! needs at least %u arguments.", name, min)); } _ => return elts /* we are good */ } } _ => { - cx.span_fatal(sp, fmt!("#%s: malformed invocation", name)) + cx.span_fatal(sp, fmt!("%s!: malformed invocation", name)) } }, - None => cx.span_fatal(sp, fmt!("#%s: missing arguments", name)) + None => cx.span_fatal(sp, fmt!("%s!: missing arguments", name)) } } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 8cecceb2e55..37fb0f05cbd 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -1,6 +1,6 @@ /* - * The compiler code necessary to support the #env extension. Eventually this + * The compiler code necessary to support the env! extension. Eventually this * should all get sucked into either the compiler syntax extension plugin * interface. */ @@ -15,7 +15,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, // FIXME (#2248): if this was more thorough it would manufacture an // Option<str> rather than just an maybe-empty string. - let var = expr_to_str(cx, args[0], ~"#env requires a string"); + let var = expr_to_str(cx, args[0], ~"env! requires a string"); match os::getenv(var) { option::None => return mk_uniq_str(cx, sp, ~""), option::Some(s) => return mk_uniq_str(cx, sp, s) diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index ea493eab561..e24575f6cd3 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -1,7 +1,7 @@ /* - * The compiler code necessary to support the #fmt extension. Eventually this + * The compiler code necessary to support the fmt! extension. Eventually this * should all get sucked into either the standard library extfmt module or the * compiler syntax extension plugin interface. */ @@ -16,7 +16,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: ast::mac_arg, let args = get_mac_args_no_max(cx, sp, arg, 1u, ~"fmt"); let fmt = expr_to_str(cx, args[0], - ~"first argument to #fmt must be a string literal."); + ~"first argument to fmt! must be a string literal."); let fmtspan = args[0].span; debug!("Format string:"); log(debug, fmt); @@ -76,7 +76,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, let count_is_args = ~[count_lit]; return mk_call(cx, sp, count_is_path, count_is_args); } - _ => cx.span_unimpl(sp, ~"unimplemented #fmt conversion") + _ => cx.span_unimpl(sp, ~"unimplemented fmt! conversion") } } fn make_ty(cx: ext_ctxt, sp: span, t: Ty) -> @ast::expr { @@ -133,7 +133,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, _ => return false } } - let unsupported = ~"conversion not supported in #fmt string"; + let unsupported = ~"conversion not supported in fmt! string"; match cnv.param { option::None => (), _ => cx.span_unimpl(sp, unsupported) @@ -145,14 +145,14 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, if !is_signed_type(cnv) { cx.span_fatal(sp, ~"+ flag only valid in " + - ~"signed #fmt conversion"); + ~"signed fmt! conversion"); } } FlagSpaceForSign => { if !is_signed_type(cnv) { cx.span_fatal(sp, ~"space flag only valid in " + - ~"signed #fmt conversions"); + ~"signed fmt! conversions"); } } FlagLeftZeroPad => (), @@ -252,7 +252,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, n += 1u; if n >= nargs { cx.span_fatal(sp, - ~"not enough arguments to #fmt " + + ~"not enough arguments to fmt! " + ~"for the given format string"); } debug!("Building conversion:"); @@ -267,7 +267,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, if expected_nargs < nargs { cx.span_fatal - (sp, fmt!("too many arguments to #fmt. found %u, expected %u", + (sp, fmt!("too many arguments to fmt!. found %u, expected %u", nargs, expected_nargs)); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c3c182d6687..4457c64a68c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2414,7 +2414,7 @@ impl parser { fn expect_self_ident() { if !self.is_self_ident() { - self.fatal(#fmt("expected `self` but found `%s`", + self.fatal(fmt!("expected `self` but found `%s`", token_to_str(self.reader, self.token))); } self.bump(); @@ -2696,7 +2696,7 @@ impl parser { ctor_decl(a_fn_decl, attrs, blk, s) => { match the_ctor { Some((_, _, _, s_first)) => { - self.span_note(s, #fmt("Duplicate constructor \ + self.span_note(s, fmt!("Duplicate constructor \ declaration for class %s", *self.interner.get(class_name))); self.span_fatal(copy s_first, ~"First constructor \ @@ -2710,7 +2710,7 @@ impl parser { dtor_decl(blk, attrs, s) => { match the_dtor { Some((_, _, s_first)) => { - self.span_note(s, #fmt("Duplicate destructor \ + self.span_note(s, fmt!("Duplicate destructor \ declaration for class %s", *self.interner.get(class_name))); self.span_fatal(copy s_first, ~"First destructor \ |
