Skip to content

Commit 2da5f6c

Browse files
bstriecatamorphism
authored andcommitted
---
yaml --- r: 38635 b: refs/heads/incoming c: e94e82c h: refs/heads/master i: 38633: 10ce87d 38631: e66012f v: v3
1 parent 4cdad67 commit 2da5f6c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 5cf0c658f3c26a6df730ec3eb0b447234d210c9d
9+
refs/heads/incoming: e94e82cb8ef0491667bc8041d370199aed838f2d
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/tutorial.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ and [`core::str`]. Here are some examples.
15021502
# fn unwrap_crayon(c: Crayon) -> int { 0 }
15031503
# fn eat_crayon_wax(i: int) { }
15041504
# fn store_crayon_in_nasal_cavity(i: uint, c: Crayon) { }
1505-
# fn crayon_to_str(c: Crayon) -> ~str { ~"" }
1505+
# fn crayon_to_str(c: Crayon) -> &str { "" }
15061506
15071507
let crayons = &[Almond, AntiqueBrass, Apricot];
15081508
@@ -1649,11 +1649,11 @@ callers may pass any kind of closure.
16491649

16501650
~~~~
16511651
fn call_twice(f: fn()) { f(); f(); }
1652-
call_twice(|| { ~"I am an inferred stack closure"; } );
1653-
call_twice(fn&() { ~"I am also a stack closure"; } );
1654-
call_twice(fn@() { ~"I am a managed closure"; });
1655-
call_twice(fn~() { ~"I am an owned closure"; });
1656-
fn bare_function() { ~"I am a plain function"; }
1652+
call_twice(|| { "I am an inferred stack closure"; } );
1653+
call_twice(fn&() { "I am also a stack closure"; } );
1654+
call_twice(fn@() { "I am a managed closure"; });
1655+
call_twice(fn~() { "I am an owned closure"; });
1656+
fn bare_function() { "I am a plain function"; }
16571657
call_twice(bare_function);
16581658
~~~~
16591659

@@ -1767,7 +1767,7 @@ And using this function to iterate over a vector:
17671767
# use println = io::println;
17681768
each(&[2, 4, 8, 5, 16], |n| {
17691769
if *n % 2 != 0 {
1770-
println(~"found odd number!");
1770+
println("found odd number!");
17711771
false
17721772
} else { true }
17731773
});
@@ -1784,7 +1784,7 @@ to the next iteration, write `loop`.
17841784
# use println = io::println;
17851785
for each(&[2, 4, 8, 5, 16]) |n| {
17861786
if *n % 2 != 0 {
1787-
println(~"found odd number!");
1787+
println("found odd number!");
17881788
break;
17891789
}
17901790
}
@@ -1967,12 +1967,12 @@ impl int: Printable {
19671967
fn print() { io::println(fmt!("%d", self)) }
19681968
}
19691969
1970-
impl ~str: Printable {
1970+
impl &str: Printable {
19711971
fn print() { io::println(self) }
19721972
}
19731973
19741974
# 1.print();
1975-
# (~"foo").print();
1975+
# ("foo").print();
19761976
~~~~
19771977

19781978
Methods defined in an implementation of a trait may be called just like
@@ -2162,8 +2162,8 @@ additional modules.
21622162

21632163
~~~~
21642164
mod farm {
2165-
pub fn chicken() -> ~str { ~"cluck cluck" }
2166-
pub fn cow() -> ~str { ~"mooo" }
2165+
pub fn chicken() -> &str { "cluck cluck" }
2166+
pub fn cow() -> &str { "mooo" }
21672167
}
21682168
21692169
fn main() {
@@ -2360,13 +2360,13 @@ these two files:
23602360
~~~~
23612361
// world.rs
23622362
#[link(name = "world", vers = "1.0")];
2363-
pub fn explore() -> ~str { ~"world" }
2363+
pub fn explore() -> &str { "world" }
23642364
~~~~
23652365

23662366
~~~~ {.xfail-test}
23672367
// main.rs
23682368
extern mod world;
2369-
fn main() { io::println(~"hello " + world::explore()); }
2369+
fn main() { io::println("hello " + world::explore()); }
23702370
~~~~
23712371

23722372
Now compile and run like this (adjust to your platform if necessary):

0 commit comments

Comments
 (0)