Skip to content

Commit a51c0f8

Browse files
committed
---
yaml --- r: 31074 b: refs/heads/incoming c: 035cfcb h: refs/heads/master v: v3
1 parent 94d70c4 commit a51c0f8

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
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: f96a2a2ca16a44f869336f7e28fc261551c1184c
9+
refs/heads/incoming: 035cfcbe7218018c1bab29a987ee1152ccd1dcf7
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/tutorial.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,13 +2044,11 @@ However, consider this function:
20442044
# type Circle = int; type Rectangle = int;
20452045
# impl int: Drawable { fn draw() {} }
20462046
# fn new_circle() -> int { 1 }
2047-
20482047
trait Drawable { fn draw(); }
20492048
20502049
fn draw_all<T: Drawable>(shapes: ~[T]) {
20512050
for shapes.each |shape| { shape.draw(); }
20522051
}
2053-
20542052
# let c: Circle = new_circle();
20552053
# draw_all(~[c]);
20562054
~~~~
@@ -2062,7 +2060,7 @@ needed, a trait name can alternately be used as a type.
20622060

20632061
~~~~
20642062
# trait Drawable { fn draw(); }
2065-
fn draw_all(shapes: ~[@Drawable]) {
2063+
fn draw_all(shapes: &[@Drawable]) {
20662064
for shapes.each |shape| { shape.draw(); }
20672065
}
20682066
~~~~
@@ -2077,15 +2075,15 @@ to cast a value to a trait type:
20772075
# trait Drawable { fn draw(); }
20782076
# fn new_circle() -> Circle { 1 }
20792077
# fn new_rectangle() -> Rectangle { true }
2080-
# fn draw_all(shapes: ~[Drawable]) {}
2078+
# fn draw_all(shapes: &[@Drawable]) {}
20812079
20822080
impl @Circle: Drawable { fn draw() { ... } }
20832081
20842082
impl @Rectangle: Drawable { fn draw() { ... } }
20852083
20862084
let c: @Circle = @new_circle();
20872085
let r: @Rectangle = @new_rectangle();
2088-
draw_all(~[c as @Drawable, r as @Drawable]);
2086+
draw_all(&[c as @Drawable, r as @Drawable]);
20892087
~~~~
20902088

20912089
Note that, like strings and vectors, trait types have dynamic size
@@ -2130,10 +2128,9 @@ explicitly import it, you must refer to it by its long name,
21302128
`farm::chicken`.
21312129

21322130
~~~~
2133-
#[legacy_exports]
21342131
mod farm {
2135-
fn chicken() -> ~str { ~"cluck cluck" }
2136-
fn cow() -> ~str { ~"mooo" }
2132+
pub fn chicken() -> ~str { ~"cluck cluck" }
2133+
pub fn cow() -> ~str { ~"mooo" }
21372134
}
21382135
fn main() {
21392136
io::println(farm::chicken());

0 commit comments

Comments
 (0)