Skip to content

Commit 3d6ae90

Browse files
committed
---
yaml --- r: 30014 b: refs/heads/incoming c: 3453638 h: refs/heads/master v: v3
1 parent b140f2e commit 3d6ae90

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 29f32b4a7298b0807408658bc8add1de8a06ab12
9+
refs/heads/incoming: 345363866c4e66f97b54bd9c79f3a94fd30a555d
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,10 +2254,10 @@ log(core::error, ~"file not found: " + filename);
22542254
log(error, ~"file not found: " + filename);
22552255
22562256
// Formatting the message using a format-string and #fmt
2257-
log(error, #fmt("file not found: %s", filename));
2257+
log(error, fmt!("file not found: %s", filename));
22582258
22592259
// Using the #error macro, that expands to the previous call.
2260-
#error("file not found: %s", filename);
2260+
error!("file not found: %s", filename);
22612261
~~~~
22622262

22632263
A `log` expression is *not evaluated* when logging at the specified
@@ -2328,7 +2328,7 @@ and the syntax to expand into. An example:
23282328
#macro([#apply[fn, [args, ...]], fn(args, ...)]);
23292329
~~~~~~~~
23302330

2331-
In this case, the invocation `#apply[sum, 5, 8, 6]` expands to
2331+
In this case, the invocation `apply!(sum, 5, 8, 6)` expands to
23322332
`sum(5,8,6)`. If `...` follows an expression (which need not be as
23332333
simple as a single identifier) in the input syntax, the matcher will expect an
23342334
arbitrary number of occurrences of the thing preceding it, and bind syntax to
@@ -2348,12 +2348,12 @@ sophisticated example:
23482348
#macro([#unzip_literals[[x, y], ...], [[x, ...], [y, ...]]]);
23492349
~~~~~~~~
23502350

2351-
In this case, `#zip_literals[[1,2,3], [1,2,3]]` expands to
2352-
`[[1,1],[2,2],[3,3]]`, and `#unzip_literals[[1,1], [2,2], [3,3]]`
2351+
In this case, `zip_literals!([1,2,3], [1,2,3])` expands to
2352+
`[[1,1],[2,2],[3,3]]`, and `unzip_literals!([1,1], [2,2], [3,3])`
23532353
expands to `[[1,2,3],[1,2,3]]`.
23542354

23552355
Macro expansion takes place outside-in: that is,
2356-
`#unzip_literals[#zip_literals[[1,2,3],[1,2,3]]]` will fail because
2356+
`unzip_literals!(zip_literals!([1,2,3],[1,2,3]))` will fail because
23572357
`unzip_literals` expects a list, not a macro invocation, as an argument.
23582358

23592359
The macro system currently has some limitations. It's not possible to

branches/incoming/doc/tutorial.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn main() {
100100
// Report the results as the games complete
101101
for range(0, times) |round| {
102102
let winner = result_from_game.recv();
103-
println(#fmt("%s wins round #%u", winner, round));
103+
println(fmt!("%s wins round #%u", winner, round));
104104
}
105105
106106
fn play_game(player1: ~str, player2: ~str) -> ~str {
@@ -650,7 +650,7 @@ one is `#fmt`, a printf-style text formatting macro that is expanded
650650
at compile time.
651651

652652
~~~~
653-
io::println(#fmt("%s is %d", ~"the answer", 42));
653+
io::println(fmt!("%s is %d", ~"the answer", 42));
654654
~~~~
655655

656656
`#fmt` supports most of the directives that [printf][pf] supports, but
@@ -664,7 +664,7 @@ All syntax extensions look like `#word`. Another built-in one is
664664
compile-time.
665665

666666
~~~~
667-
io::println(#env("PATH"));
667+
io::println(env!("PATH"));
668668
~~~~
669669

670670
# Control structures
@@ -908,8 +908,8 @@ and will log the formatted string:
908908

909909
~~~~
910910
# fn get_error_string() -> ~str { ~"boo" }
911-
#warn("only %d seconds remaining", 10);
912-
#error("fatal: %s", get_error_string());
911+
warn!("only %d seconds remaining", 10);
912+
error!("fatal: %s", get_error_string());
913913
~~~~
914914

915915
Because the macros `#debug`, `#warn`, and `#error` expand to calls to `log`,
@@ -1578,7 +1578,7 @@ the enclosing scope.
15781578
fn call_closure_with_ten(b: fn(int)) { b(10); }
15791579
15801580
let captured_var = 20;
1581-
let closure = |arg| println(#fmt("captured_var=%d, arg=%d", captured_var, arg));
1581+
let closure = |arg| println(fmt!("captured_var=%d, arg=%d", captured_var, arg));
15821582
15831583
call_closure_with_ten(closure);
15841584
~~~~
@@ -1706,7 +1706,7 @@ structure.
17061706
# fn each(v: ~[int], op: fn(int)) {}
17071707
# fn do_some_work(i: int) { }
17081708
each(~[1, 2, 3], |n| {
1709-
#debug("%i", n);
1709+
debug!("%i", n);
17101710
do_some_work(n);
17111711
});
17121712
~~~~
@@ -1718,7 +1718,7 @@ call that can be written more like a built-in control structure:
17181718
# fn each(v: ~[int], op: fn(int)) {}
17191719
# fn do_some_work(i: int) { }
17201720
do each(~[1, 2, 3]) |n| {
1721-
#debug("%i", n);
1721+
debug!("%i", n);
17221722
do_some_work(n);
17231723
}
17241724
~~~~
@@ -1735,7 +1735,7 @@ takes a final closure argument.
17351735
import task::spawn;
17361736
17371737
do spawn() || {
1738-
#debug("I'm a task, whatever");
1738+
debug!("I'm a task, whatever");
17391739
}
17401740
~~~~
17411741

@@ -1746,7 +1746,7 @@ there?
17461746
~~~~
17471747
# import task::spawn;
17481748
do spawn {
1749-
#debug("Kablam!");
1749+
debug!("Kablam!");
17501750
}
17511751
~~~~
17521752

@@ -2558,7 +2558,7 @@ extern mod crypto {
25582558
25592559
fn as_hex(data: ~[u8]) -> ~str {
25602560
let mut acc = ~"";
2561-
for data.each |byte| { acc += #fmt("%02x", byte as uint); }
2561+
for data.each |byte| { acc += fmt!("%02x", byte as uint); }
25622562
return acc;
25632563
}
25642564
@@ -2759,7 +2759,7 @@ fn unix_time_in_microseconds() -> u64 unsafe {
27592759
return (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
27602760
}
27612761
2762-
# fn main() { assert #fmt("%?", unix_time_in_microseconds()) != ~""; }
2762+
# fn main() { assert fmt!("%?", unix_time_in_microseconds()) != ~""; }
27632763
~~~~
27642764

27652765
The `#[nolink]` attribute indicates that there's no foreign library to
@@ -2799,7 +2799,7 @@ let some_value = 22;
27992799
28002800
do spawn {
28012801
println(~"This executes in the child task.");
2802-
println(#fmt("%d", some_value));
2802+
println(fmt!("%d", some_value));
28032803
}
28042804
~~~~
28052805

0 commit comments

Comments
 (0)